View previous topic :: View next topic |
Author |
Message |
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
Posted: Tue Feb 17, 2015 2:27 am Post subject: Help Fixing My Smarty Code |
|
|
I am new to Smarty and wondering if someone could help me with this:
I have an RSS feed on a page which is outputting my news stories with Title/Description/Date
Each news story has an image in it with text wrapped to the right-I want to include a thumbnail image of the original image in the news story INTO the RSS feed with text wrapped right
Here is the working code without the thumbnail image
Code: | <rss version="2.0">
<channel>
<title>{$rss_title}</title>
<description>{$rss_desc}</description>
<link>{$rss_url}</link>
<lastBuildDate>{$rss_builddate}</lastBuildDate>
{foreach $_items as $item}
<item>
<title>{$item.oilfieldnews_title}</title>
<link>{$jamroom_url}/{$item.profile_url}/{jrCore_module_url module="xxOilfieldNews"}/{$item._item_id}/{$item.oilfieldnews_title_url}</link>
<description>{$item.oilfieldnews_body|jrCore_format_string:$item.profile_quota_id|strip_tags}</description>
<pubDate>{$item.oilfieldnews_date|jrCore_format_time:false:"%a, %d %b %Y %T %Z"}</pubDate>
</item>
{/foreach}
</channel>
</rss> |
Here is the code after I try to insert a thumbnail of the original image
Code: | <rss version="2.0">
<channel>
<title>{$rss_title}</title>
<description>{$rss_desc}</description>
<image>{$rss_image}</image>
<link>{$rss_url}</link>
<lastBuildDate>{$rss_builddate}</lastBuildDate>
{foreach $_items as $item}
<item>
<title>{$item.oilfieldnews_title}</title>
<link>{$jamroom_url}/{$item.profile_url}/{jrCore_module_url module="xxOilfieldNews"}/{$item._item_id}/{$item.oilfieldnews_title_url}</link>
<image>{$item.oilfieldnews_image|jrCore_format_string:$item.oilfieldnews_image_id| module="xxOilfieldNews" type="xxOilfieldNews_image" item_id=$item._item_id size="small" crop="auto" class="iloutline" alt=$item.xxOilfieldNews_title}</image>
<description>{$item.oilfieldnews_body|jrCore_format_string:$item.profile_quota_id|strip_tags}</description>
<pubDate>{$item.oilfieldnews_date|jrCore_format_time:false:"%a, %d %b %Y %T %Z"}</pubDate>
</item>
{/foreach}
</channel> |
I am sure I am way off on this and wondering if anyone here could help with what I am trying to do
Thank you
</rss> |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Feb 17, 2015 3:05 am Post subject: |
|
|
You're missing the point. RSS specification does not describe presentation, and this is intentional.
The presentation of the RSS stream is up to the reader's UA. |
|
Back to top |
|
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
Posted: Tue Feb 17, 2015 3:11 am Post subject: |
|
|
Thank you- but I am using RSS to display a slider on my home page that displays the last 5 news items posted- it has clickable links that take you to the full article on the site |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Feb 17, 2015 3:46 am Post subject: |
|
|
Which means, the web page (the JavaScript, that pull in the RSS?) is your User-Agent, and responsible for converting the RSS format to HTML. |
|
Back to top |
|
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
Posted: Tue Feb 17, 2015 4:43 am Post subject: |
|
|
No I use "RSS Include" for that - an app I have been using for a few years |
|
Back to top |
|
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
Posted: Tue Feb 17, 2015 4:50 am Post subject: |
|
|
The purpose of this code is not to format an rss feed for the reader- it is to deliver the content in a slider to the home page of the website |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Feb 17, 2015 5:23 am Post subject: |
|
|
I think you don't understand. RSS format is not compatible with HTML, you can't just "display" it, in a slider or othervise, within the web page.
At maximum, you can fetch the <description> from RSS, and display THAT, if you know it is in HTML format.
I.e. http://www.swtor.com/feed/news |
|
Back to top |
|
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
Posted: Tue Feb 17, 2015 5:56 am Post subject: |
|
|
Thanks- I just put it up on a test page so you can see it working here
http://theamericandriller.com/test
The purpose of the code I need is to add a thumbnail image into the slider text ( which it gets from the original page)
I have seen it many time and even done it- but do not know how to do it with smarty
Thank you |
|
Back to top |
|
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
|
Back to top |
|
derrickhand Smarty Rookie
Joined: 11 Jan 2015 Posts: 8
|
Posted: Tue Feb 17, 2015 6:06 am Post subject: |
|
|
I have added another feed to the above test link with images in the feed
I think images begin on the second page ...
I want images like this in my feed BUT as thumbnails with text wrapped right |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Feb 17, 2015 6:21 am Post subject: |
|
|
I can't see your test page. Says "The page you requested was not found!" |
|
Back to top |
|
|