RSS <description> not displaying hyperlink.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blepoxp
Forum Newbie
Posts: 16
Joined: Tue Feb 13, 2007 12:13 pm

RSS <description> not displaying hyperlink.

Post by blepoxp »

Hello,

Could anyone tell me why this isn't working?

Code: Select all

<description><a href=\"$link\">Please click here for the full article.</a></description>
The above code would output the text without a link, but the source code of the page looks normal:

Code: Select all

<description><a href="/index.cfm?PgType=2&ArticleID=479">Please click here if you like cupcakes</a></description>
Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If memory serves, there is no anchor tag in the RSS standard. The message should be passed through htmlentities. However what you are doing is handled elsewhere by the standard already via the <link> tag. Some feeds use <!CDATA[...]]> sections too (although for content mostly.)
blepoxp
Forum Newbie
Posts: 16
Joined: Tue Feb 13, 2007 12:13 pm

Post by blepoxp »

Thanks.
I've noticed that the <link> tag adds the "Read Complete Article" here to the description. Do you know of any way to change what that text says? I would like to customize it.

BTW, my link variable that I had wrapped in the anchor had the htmlentities:

Code: Select all

$link = htmlentities('/index.cfm?PgType=2&ArticleID=' . $line['ArticleID']);
Is it just not possible to customize the link text?
blepoxp
Forum Newbie
Posts: 16
Joined: Tue Feb 13, 2007 12:13 pm

Post by blepoxp »

The following code, which succesfully created multiple links within the description tag worked but I can't seem to adapt it to what I need because of my lack of experience with PHP. I think it's got to do with my syntax.

Code: Select all

$output .="<pubDate>{$row['Created']}</pubDate> \n
                                    <description><p>{$row['ShortBlurb']}</p><ul>";
                                foreach ($cache2 as $row2)
 { if ($row2['Doc_ResID'] == $row['Res_ID'])
     {$output .= "<li><a href=\"\uploads\old".substr($row2['Doc_Location'], 25)."\">".$row2['Doc_Title']."</a></li>";}
                                     
                       		  		
			   }$output .="</ul></description>
Any ideas?
Post Reply