[SOLVED]: CGFeedmaker (rss) and the ampersand character in my Article title

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
Locked
joecannes
Forum Members
Forum Members
Posts: 93
Joined: Mon Nov 26, 2007 5:00 pm
Location: Montreal, Quebec

[SOLVED]: CGFeedmaker (rss) and the ampersand character in my Article title

Post by joecannes »

I am using CMSMS 1.5.2 MLE, without rewrite_URLs on, and have gotten CGFeedMaker to work, by creating an RSS of my News feeds from the News Module. I have 2 categories in my news module called Conferences_english and Speaking_Engagements_english

If I have an ampersand (&) character in my Article title, my RSS feed messes up. I get this error in IE &:

Internet Explorer cannot display this feed

   This feed contains code errors.
     Go back to the previous page.

     More information

Whitespace is not allowed at this location.
Line: 20 Character: 32

      World Stem Cells & Regenerative Medicine Congress



and I can't figure out why this is happenning. When I look at the page source, the content is there


Anyone run into this problem and know why this is happening?

Below is my RSS Template:

Code: Select all

{* original rss feed template *}
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>{$feed.title}</title>
    {if isset($feed.link) && !empty($feed.link)}<link>{$feed.link}</link>{/if}
    {if isset($feed.description) && !empty($feed.description)}<description>{$feed.description}</description>{/if}
    {if isset($feed.copyright) && !empty($feed.copyright)}<copyright>{$feed.copyright}</copyright>{/if}
    {if isset($generator)}<generator>{$generator}</generator>{/if}
    {if isset($feed.managing_editor) && !empty($feed.managing_editor)}<managingEditor>{$feed.managing_editor}</managingEditor>{/if}
    {if isset($admin_email)}<webMaster>{$admin_email} ({$admin_user->firstname} {$admin_user->lastname})</webMaster>{/if}
    {if isset($feed.image) && !empty($feed.image)}
      <image>
	{if isset($feed.description) && !empty($feed.description)}<description>{$feed.description}</description>{/if}
        {if isset($feed.link) && !empty($feed.link)}<link>{$feed.link}</link>{/if}
        <title>{$feed.title}</title>
        <url>{$file_location}/{$feed.image}</url>
      </image>
    {/if}

    {* an example of how to create a feed from a call to the news module *}
    {* you can use any smarty variable that is available in the news summary template *}
    {* you can substitute this logic with output from any module that supports a summary
       view, or possibly get artistic and mix output from different modules *}
     {news category='Conferences_english,Speaking_Engagements_english' assign='junk'}
    {foreach from=$items item='entry'}
    <item>
      <title>{$entry->title|cms_html_entity_decode}</title>
      <link>{$entry->moreurl}</link>
      {capture assign='description'}{if isset($entry->summary)}{$entry->summary}{else}{$entry->content}{/if}{/capture}
      <description>{$description|trim|strip_tags|summarize:40}</description>
      <pubDate>{$entry->postdate|rfc_date}</pubDate>
      <guid>{$entry->moreurl}</guid>
    </item>
    {/foreach}
  </channel>
</rss>
ANy help would be much appreciated,


JC
Last edited by joecannes on Fri Feb 27, 2009 2:20 pm, edited 1 time in total.
joecannes
Forum Members
Forum Members
Posts: 93
Joined: Mon Nov 26, 2007 5:00 pm
Location: Montreal, Quebec

[SOLVED]: CGFeedmaker (rss) and the ampersand character in my Article title

Post by joecannes »

I have fixed my problem, and it works and validates, but I dont know what it did. If someone can explain to me why its working, that would great.

Basically, in the RSS Template, I edited this line:

Code: Select all

<title>{$entry->title|cms_html_entity_decode}</title>
and changed it to:

Code: Select all

<title><![CDATA[{$entry->title}]]></title>
and it worked!

CGFeedMaker was pre-installed with example feeds. So Ihad a look at the "Blog" feed example, and used that code, and inserted into the  "News" feed example, and it is fine now!

But I dont know what is the difference between the two, if someone can explain, that would be nice to know!

Thanks,

JC
Last edited by joecannes on Fri Feb 27, 2009 2:20 pm, edited 1 time in total.
iNSiPiD

Re: [SOLVED]: CGFeedmaker (rss) and the ampersand character in my Article title

Post by iNSiPiD »

This doesn't actually solve anything and is not recommended in the RSS spec. All it's doing is allowing illegal data to enter your feed.
joecannes
Forum Members
Forum Members
Posts: 93
Joined: Mon Nov 26, 2007 5:00 pm
Location: Montreal, Quebec

Re: [SOLVED]: CGFeedmaker (rss) and the ampersand character in my Article title

Post by joecannes »

Is there another way then?
Locked

Return to “[locked] CMSMS MLE fork”