Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Help Fixing My Smarty Code

 
Post new topic   Reply to topic    Smarty Forum Index -> Help Wanted (commercial)
View previous topic :: View next topic  
Author Message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 2:27 am    Post subject: Help Fixing My Smarty Code Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1704

PostPosted: Tue Feb 17, 2015 3:05 am    Post subject: Reply with quote

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
View user's profile Send private message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 3:11 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1704

PostPosted: Tue Feb 17, 2015 3:46 am    Post subject: Reply with quote

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
View user's profile Send private message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 4:43 am    Post subject: Reply with quote

No I use "RSS Include" for that - an app I have been using for a few years
Back to top
View user's profile Send private message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 4:50 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1704

PostPosted: Tue Feb 17, 2015 5:23 am    Post subject: Reply with quote

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
View user's profile Send private message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 5:56 am    Post subject: Reply with quote

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
View user's profile Send private message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 5:59 am    Post subject: Reply with quote

you can see the XML data it is sending to RSS Include here
http://theamericandriller.com/feed/oilfield-news
then its displayed on the site using either a script or a few other options
Back to top
View user's profile Send private message
derrickhand
Smarty Rookie


Joined: 11 Jan 2015
Posts: 8

PostPosted: Tue Feb 17, 2015 6:06 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1704

PostPosted: Tue Feb 17, 2015 6:21 am    Post subject: Reply with quote

I can't see your test page. Says "The page you requested was not found!"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Help Wanted (commercial) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP