Forums / Setup & design / Intranet / the "latest" listing

Intranet / the "latest" listing

Author Message

Flying Man

Monday 31 July 2006 12:08:58 pm

I'd like to show the "latest" listing under, and only under, a specific Folder object. I do not want it displayed on the Home Page of the intranet. What file do I edit and what do I put into it? I guess there would have to be a conditional branch to test if one of the parents / predecessors is the specified Folder object (I can have several object instances of various classes under that specified Folder object and I would like to show the latest listing on all of them as long as one of the parents in the tree is the specified Folder object).

Any suggestions?

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

eZ debug

Timing: Jan 21 2025 01:58:39
Script start
Timing: Jan 21 2025 01:58:39
Module start 'content'
Timing: Jan 21 2025 01:58:40
Module end 'content'
Timing: Jan 21 2025 01:58:40
Script end

Main resources:

Total runtime1.3176 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0083 591.7891180.8359
Module start 'content' 0.00841.1498 772.6250498.9609
Module end 'content' 1.15820.1594 1,271.5859333.5078
Script end 1.3175  1,605.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.3098210.0002
Check MTime0.00150.1110210.0001
Mysql Total
Database connection0.00130.095810.0013
Mysqli_queries1.216292.30341910.0064
Looping result0.00200.15021890.0000
Template Total1.272696.620.6363
Template load0.00240.182220.0012
Template processing1.270296.400720.6351
Template load and register function0.00020.017110.0002
states
state_id_array0.00140.103810.0014
state_identifier_array0.00150.114220.0008
Override
Cache load0.00190.1422310.0001
Sytem overhead
Fetch class attribute can translate value0.00180.139130.0006
Fetch class attribute name0.00120.092420.0006
XML
Image XML parsing0.00090.070730.0003
class_abstraction
Instantiating content class attribute0.00000.000720.0000
General
dbfile0.02041.5455210.0010
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs