Intranet / the "latest" listing

Intranet / the "latest" listing

Monday 31 July 2006 12:08:58 pm - 1 reply

Modified on Monday 31 July 2006 12:12:35 pm by Flying Man

Author Message

Claudia Kosny

Saturday 12 August 2006 3:53:16 pm

Hi there,

sorry for the late reaction... On the offchance that you do not have a solution by now here some ideas:

A good example for the latest listing is the node listing found in \design\standard\templates\toolbar\full\node_list.tpl which is controlled by the settings in toolbar.ini.append.php in the settings directory of your siteaccess (unless you have changed it already).

Here a simplified overview on how to fetch the nodes

{let node_list= fetch( content, tree, hash( parent_node_id, $parent_node,
limit, $limit,
class_filter_type, exclude,
class_filter_array, array( 'folder' ),
sort_by, array( 'published', false() ) ) )}

The fetch function 'tree' fetches all (or in this case $limit) nodes that are somewhere in the subtree of the node with the id $parent_node and which are not of the type folder. These nodes are sorted by their published attribute in descending order, so that the newest nodes come first.
For more information on the options of the fetch function tree just check:
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/tree

As parent node id you can either use '2' to get the listing of the latest nodes site wide or you can specify the id of an folder of your choice. This does _not_ depend on where you display the listing.

To display the nodes you can just use foreach to go through the array returned by the fetch function, something like this:

{foreach $node_list as $item}
{$item.name} <br />
{/foreach}

To display the listing on all pages that show objects under a specific folder you first have to include the necessary code in the templates used for these objects. As you most likely will have different objects of different classes and thus different templates I would put the code for the listing in an external file (e.g. 'latest_nodes_listing.tpl') and include this file in each of the templates.
Here an example on how to include a template file in another template file
{include uri="design:latest_nodes_listing.tpl"}

As you already stated in your post you still have to make sure to display the listing only if the currently displayed node is somewhere in the subtree of your specified folder. To do this you just need to check if the id of your specified folder is in the pathstring of the currently displayed node, roughly like this
{if $node.path_string|contains(concat('/', id of your specified folder, '/' ))}
{include uri="design:latest_nodes_listing.tpl"}
{/if}

Claudia

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.