Reputation: 129
I'm trying to display an image beside or before my description tag in my rss, I have tried on my localhost it worked like this:
<description><![CDATA[<img src="<?php echo $img; ?>">test test test test testtest test test test]]></description>
but on my website it's some kind different like this:
echo '
<item>
<title>'.$article[title].'</title>
<description><![CDATA[<img src="$img_path">
'.$shortdesc.'
]]></description>
</item>';
it's not working like this what is wrong in this ode? it's returnes blank iamge, here it's the page source from browser:
<description><![CDATA[<img src="$img_path">test test test</description>
Upvotes: 0
Views: 355
Reputation: 117334
PHP-code within single-quotes will not be parsed.
echo '
<item>
<title>'.$article['title']."</title>
<description><![CDATA[<img src='{$img_path}'>
".$shortdesc.'
]]></description>
</item>';
or
echo '
<item>
<title>'.$article['title'].'</title>
<description><![CDATA[<img src="'.$img_path.'">
'.$shortdesc.'
]]></description>
</item>';
Upvotes: 1