Einfachen RSS-Block implementieren (ezFlow-Feedreader)

02.11.2011 | eZ Publish

Einen FeedBlock definieren in block.ini.append.php 


[RSSFeedReader]
Name=RSS Feed (automatisch)
ManualAddingOfItems=disabled
CustomAttributes[]
CustomAttributes[]=source
CustomAttributeTypes[source]=string
CustomAttributes[]=limit
CustomAttributeTypes[limit]=string
CustomAttributes[]=offset
CustomAttributeTypes[offset]=string
ViewList[]=rssfeed_reader
ViewName[rssfeed_reader]=RSS Feed

ZoneIdentifier[]
ZoneIdentifier[]=middle
ZoneIdentifier[]=left
ZoneIdentifier[]=right

### Default START ###
CustomAttributes[]=Boxueberschrift
CustomAttributeTypes[Boxueberschrift]=text

### Default END ###

Ein Feedblock-Template erstellen in override/templates/block/rssfeed_reader.tpl

{cache-block expiry=300 keys=array($block.custom_attributes.source, $block.custom_attributes.limit, $block.custom_attributes.offset)}
{def $source = $block.custom_attributes.source
$limit = $block.custom_attributes.limit
$offset = $block.custom_attributes.offset
$res = feedreader( $source, $limit, $offset )
$valid_nodes = $block.valid_nodes
}
<div class="block-view {if ne($block_position,'middle')}block-small-view rss-box{else}block-large-view{/if}">
{include uri='design:tools/eZFlow_headerline.tpl' block=$block valid_nodes=$valid_nodes}
<ul class="nospace noindent">
{foreach $res.items as $item}
<li>
<a href="{$item.links[0]}" title="{$item.title|wash()}">{$item.title|wash()}</a>
</li>
{/foreach}
</ul>
</div>
{/cache-block}
{undef $valid_nodes}

Getestet auf eZ-Standard-Installation (Community Edition 2011.9) http://localhost:10088/ezp_2011.9/index.php/ger