Page 1 of 1

[SOLVED] -weird question marks showing on my RSS2HTML module

Posted: Sat Jun 04, 2011 12:44 am
by fearmydesign
I am getting these weird question marks when bringing in content using the RSS2HTML - I have tried the different settings for it like the 'Sync with CMSMS encoding' and also changed the utf-8 - but nothing is working. Can someone take a look at what I mean and maybe provide suggestions? Thank you

Please take a look at the lower-left hand box:
http://unmejorperu.com/index.php

Thank you

Re: weird question marks showing on my RSS2HTML module :-/

Posted: Sat Jun 04, 2011 4:40 am
by myshko
Hi,

You are right.

It's due to the encoding of apostrophes. The Question marks appear as the rss encoder doesn't know how to disaplay them.

You could use 'escape' on your smarty tag to replace them with the correct html entities:

Code: Select all

{$rssItem|escape:'htmlall'}
Or replace them using str_replace in a User Defined Tag.

Just some suggestions.

/m

Re: weird question marks showing on my RSS2HTML module :-/

Posted: Sun Jun 05, 2011 6:40 pm
by fearmydesign
myshko wrote: You could use 'escape' on your smarty tag to replace them with the correct html entities:

Code: Select all

{$rssItem|escape:'htmlall'}
Or replace them using str_replace in a User Defined Tag.
Thank you for your suggestions. Could you tell me how to implement either of your suggestions... I am not much of a programmer and I'm not sure where to place the Smarty tag you showed me. Thank you

Re: weird question marks showing on my RSS2HTML module :-/

Posted: Sun Jun 05, 2011 7:27 pm
by myshko
Hi fmd,

I'll try, but I can't install the module RSS2HTML (XMLMadeSimple is a newer alternative) so I have to guess how your module is implemented.

The 'escape' method involves adding the smarty modifier at the end of a smarty tag called in your template.

When you call the RSS feed into your webpage, a template somewhere in the admin of that module is used to display each part.

Within this template, there will be a tag which displays the 'description' or body of the RSS.

It will be something like this:

Code: Select all

{$xml->channel->item[0]->description}
To escape the tag and convert characters to entities, add |escape:'html' to the end, like this:

Code: Select all

{$xml->channel->item[0]->description|escape:'html'}
This will work on any smarty tag that outputs a string of text.

If you are still stuck, post the template you use from RSS2HTML and I can give more specific suggestions.

Hope that makes more sense.

/m

Re: weird question marks showing on my RSS2HTML module :-/

Posted: Mon Jun 06, 2011 6:17 pm
by fearmydesign
myshko wrote:Hi fmd,

I'll try, but I can't install the module RSS2HTML (XMLMadeSimple is a newer alternative) so I have to guess how your module is implemented.

The 'escape' method involves adding the smarty modifier at the end of a smarty tag called in your template.

When you call the RSS feed into your webpage, a template somewhere in the admin of that module is used to display each part.

Within this template, there will be a tag which displays the 'description' or body of the RSS.

It will be something like this:

Code: Select all

{$xml->channel->item[0]->description}
To escape the tag and convert characters to entities, add |escape:'html' to the end, like this:

Code: Select all

{$xml->channel->item[0]->description|escape:'html'}
This will work on any smarty tag that outputs a string of text.

If you are still stuck, post the template you use from RSS2HTML and I can give more specific suggestions.

Hope that makes more sense.

/m
Thanks for the response, I actually removed it and went with your suggestion of the XMMadeSimple - it works, but my only problem now is creating a template for it... I see that the default template has nothing on it, it's blank so the data is not showing up correctly on my site, please take a look at the lower left hand column: http://www.unmejorperu.com/index.php

Thank you

Re: weird question marks showing on my RSS2HTML module :-/

Posted: Mon Jun 06, 2011 10:39 pm
by myshko
Hi Rod,

Ok, well depending on how you want it to display your template will be different. But this is a start:

Code: Select all

{* RSS Feed List Template *}

<ul class="feed">

{foreach from=$xml->channel->item item=item name=post}
{if $smarty.foreach.post.iteration <= 3}
	<li>
		<h4><a rel="external" href="{$item->link}" title="Click to read {$item->title}">{$item->title}</a></h4>
		<p class="desc">{$item->description|truncate:120:"...":false}</p>
		<span class="date">~ {$item->pubDate|date_format:"%d/%m/%y"}</span>
		<a rel="external" class="more" href="{$item->link}" title="Click to read {$item->title}">read more~</a>
	</li>
{/if}
{/foreach}

</ul>
To explain:
  • {foreach from=$xml->channel->item item=item name=post} ~ Goes through the list of feeds and assigns each one as $item, we also set a name so we can limit how many posts we show.
  • {$item->link} ~ Displays item link
  • {$item->title} ~ Displays title
  • {$item->description|truncate:120:"...":false} ~ This outputs the description but limits (truncates) the characters displayed to 120.
  • {$item->pubDate|date_format:"%d/%m/%y"} ~ Displays the date but rewrites the format as date/month/year.
To see what other variables there are, put {$xml->channel->item|@print_r} in your template.

You can change the above to display however you like.

Regards,

/myshko

Re: weird question marks showing on my RSS2HTML module :-/

Posted: Mon Jun 06, 2011 10:53 pm
by fearmydesign
Hi Myshko, that was very helpful and I finally got it to work perfectly! thanks and i appreciate your help on this.

Re: [SOLVED] -weird question marks showing on my RSS2HTML mo

Posted: Mon Jun 06, 2011 10:57 pm
by myshko
Excellent,

You're welcome Rod and all the best finishing your site.

/m

Re: [SOLVED] -weird question marks showing on my RSS2HTML mo

Posted: Mon Dec 05, 2011 10:56 am
by Uncle Pete
+1 on the thanks Myshko.

This advice just got me out of an upgrade hole.

In my template I just replaced:

Code: Select all

{$item.title}
with

Code: Select all

{$item.title|escape:'htmlall'}
and all was right in my world again. Thanks!