Jump to content

ps_rssfeed RSS FEED BLOCK Display Image??


ukbaz

Recommended Posts

Am trying to get featured image and truncated description from WP blog to display in the rss block in footer on Prestashop 1.7.4. I have the following in template file for this module:

<!-- Block RSS module-->
<br />
<div id="rss_block_home" class="block">
    <p class="title_block"><a href="https://temperature.co.uk" target="_blank">Latest Posts from our Temperature Blog</a></p>
<br />
    <div class="block_content">
        {if $rss_links}
            <ul class="htmlcontent-home clearfix row">
                {foreach from=$rss_links item='rss_link'}
                    <li class="htmlcontent-item-2 col-xs-12 col-sm-6 col-md-4"><a href="{$rss_link.url}" target="_blank"><img class="img-responsive-blog" src="{$rss_link.image}"><br /><br /><div style="font-size:16px; text-transform:uppercase;" align="center">{$rss_link.title}</a></div>{$rss_link.description|truncate:150}<br /><br /><br /></li>
                {/foreach}
            </ul>
        {else}
            <p>{l s='No RSS feed added'}</p>
        {/if}
    </div>


</div>

Image is not displaying but, description does.

 

I assume something is missing in the php file here:

 public function hookDisplayFooter($params)
    {
        // Conf
        $title = strval(Configuration::get('RSS_FEED_TITLE'));
        $url = strval(Configuration::get('RSS_FEED_URL'));
        $nb = (int) (Configuration::get('RSS_FEED_NBR')) ? (int) (Configuration::get('RSS_FEED_NBR')) : 5;

        $cacheId = $this->getCacheId($this->name . '|' . date("YmdH"));
        if (!$this->isCached($this->templateFile, $cacheId)) {
            $rss_links = array();
            if ($url && ($contents = Tools::file_get_contents($url))) {
                try {
                    $xml = new SimpleXMLElement($contents);
                    $loop = 0;
                    if (!empty($xml->channel->item)) {
                        foreach ($xml->channel->item as $item) {
                            if (++$loop > $nb) {
                                break;
                            }
                            $rss_links[] = (array)$item;
                        }
                    }
                } catch (Exception $e) {
                    Tools::dieOrLog($this->trans('Error: invalid RSS feed in "%module_name%" module: %message%', array('%module_name%' => $this->name, '%message%' => $e->getMessage()), 'Modules.Rssfeed.Admin'));
                }
            }
 

Can anyone help with required changes to get it to display??

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...