Rss template

Report issues with Enuuk Auction Platform or Mods here - remember to raise a ticket with phpauction.net as well
Post Reply
bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

Rss template

Post by bamse » Wed Jun 26, 2013 11:31 pm

For v2.11:

I think in themes/default/Rss.php the following changes should be done:

Replace 'http' wih

Code: Select all

$siteOptions['protocol']
Add ?lang=$lang to URLs to offer detail pages.

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: Rss template

Post by RWAP » Thu Jun 27, 2013 5:06 am

bamse wrote:For v2.11:

I think in themes/default/Rss.php the following changes should be done:

Replace 'http' wih

Code: Select all

$siteOptions['protocol']
This is already implemented in Enuuk v2.11 - unless there is something missing.
Add ?lang=$lang to URLs to offer detail pages.
Yes - that probably does make sense.

bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

Re: Rss template

Post by bamse » Thu Jun 27, 2013 2:56 pm

In the version that i have, $siteoptions['protocol'] is indeed mostly implemented, but it is still missing in

Code: Select all

<description><?=htmlentities('<img src="http://'.$this->context->HTTPHost.$this->context->relativePath.$offer['imageURL'].'" />')?><?=htmlentities($offer['description'])?></description>
I believe as otherwise images are not displayed for https websites.

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: Rss template

Post by RWAP » Thu Jun 27, 2013 3:03 pm

Ah - yes, you are quite correct there - I missed that reference.

Presumably so have Enuuk !

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: Rss template

Post by RWAP » Wed Aug 14, 2013 11:23 am

Actually, I have found a few issues with the RSS feeds over time:

a) Validation - see viewtopic.php?f=8&t=419

b) Foreign characters breaking the RSS feeds (particularly ampersands in listing titles, and the ó character):

To overcome this, add a new function to class\Language.php

Code: Select all

	/**
	* Convert Special Chars
	*
	* Found Via:
	* http://us.php.net/manual/en/function.chr.php#72145
	*
	* @access    public
	* @param    string    the string
	* @return    string
	*/
	static function convert_accented_characters($string) {
	 	return strtr($string,array(
	         'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'C'=>'C', 'c'=>'c', 'C'=>'C', 'c'=>'c',
	         'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
	         'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O',
	         'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss',
	         'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e',
	         'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o',
	         'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b',
	         'ÿ'=>'y', 'R'=>'R', 'r'=>'r',
	 	));
	}
Then, in themes\default\Rss.php (or modules\themes\default\Rss.php), find:

Code: Select all

        <item>
        <title><?=$offer['name']?></title>
        <pubDate><?=date('r',strtotime($offer['startDate']))?></pubDate>
        <guid><?=$siteOptions['protocol'].'://'.$HTTPHost.$relativePath.'offer/details/'.urlencode(str_replace(' ','_',str_replace('/','%',$offer['name']))).'-'.$offer['id']?></guid>
        <link><?=$siteOptions['protocol'].'://'.$HTTPHost.$relativePath.'offer/details/'.urlencode(str_replace(' ','_',str_replace('/','%',$offer['name']))).'-'.$offer['id']?></link>
        <description><?=htmlentities('<img src="http://'.$HTTPHost.$relativePath.$offer['imageURL'].'" />')?><?=htmlentities($offer['description'])?></description>
        </item>
Change this to read:

Code: Select all

        <item>
        <title><?=str_replace('&','&',$offer['name'])?></title>
        <pubDate><?=date('r',strtotime($offer['startDate']))?></pubDate>
        <? 	$name=iconv("UTF-8", "ISO-8859-1//TRANSLIT", $offer['name']); // remove foreign characters
        	$name=Language::convert_accented_characters($name) ?>
        <guid><?=$siteOptions['protocol'].'://'.$HTTPHost.$relativePath.'offer/details/'.urlencode(str_replace(' ','-',str_replace('/','~~',htmlentities($name)))).'-'.$offer['id']?></guid>
        <link><?=$siteOptions['protocol'].'://'.$HTTPHost.$relativePath.'offer/details/'.urlencode(str_replace(' ','-',str_replace('/','~~',htmlentities($name)))).'-'.$offer['id']?></link>
        <description><?=htmlentities('<img src="'.$siteOptions['protocol'].'://'.$HTTPHost.$relativePath.$offer['imageURL'].'" alt="'.$name.'" />')?>
        <?='<![CDATA['.$offer['description'].']]>'?></description>
        </item>

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest