Forums / Setup & design / Multiple templates for new article.

Multiple templates for new article.

Author Message

Endre Solem

Friday 25 August 2006 1:50:05 am

Hello.

I guess this question must have been answered before, but I couldn't find it in the forum.

I have a site woth lots of new. We have organised it so the first 5 news articles is displayed on the frontpage, and the reste for this month in the archive.

I need a web do override the template for the article/class then its shown in the archive... is there a way to do this?

Thanks

Endre

Claudia Kosny

Thursday 31 August 2006 10:22:19 am

Hello Endre

In case you are still looking for an answer: There are several ways to achieve that depending on how you call up the articles. If I understand you right, you need two templates for the article class, one for the archived version and one for the frontpage.

On the frontpage you most likely do a fetch to get the 5 latest articles and go though the fetched nodes and display each one. A way to display them is to call up the
{node_view_gui ..} function where you can specify the template that will be used for displaying the node.
Here an example (copied from the documentation at http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/visualization/node_view_gui )

 {def $my_node=fetch( 'content', 'node', hash( 'node_id', 96 ) )}
 {node_view_gui view='example' content_node=$my_node}

In this example, node number 96 is fetched and stored in $my_node. The "node_view_gui" function is used to display the target node using the "example" view. If there are no override rules for the specified view, the system will search for "example.tpl" in the "templates/node/view/" directory of the current design. If the requested template file is not found, eZ publish will continue searching for it in the fallback designs and the standard design. 

If the archived nodes are called up using their url (something like archive/name_of_node) they are displayed using the templates/full/article.tpl template. Just override this template by creating your own template file and put it into the folder <your design folder>/override/templates/full/article.tpl.

If the archived nodes are not called up using their url you have to fetch them somehow. In this case you can use the view parameter of the node_view_gui function again, just provide a different template.

If this does not answer your question please provide more information about the structure of your site - where and how the nodes are displayed and where they are stored.

Greetings from Luxembourg

Claudia

eZ debug

Timing: Jan 30 2025 22:23:23
Script start
Timing: Jan 30 2025 22:23:23
Module start 'content'
Timing: Jan 30 2025 22:23:23
Module end 'content'
Timing: Jan 30 2025 22:23:23
Script end

Main resources:

Total runtime0.2703 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 587.9531370.2891
Module start 'content' 0.00710.0140 958.24221,001.5469
Module end 'content' 0.02110.2491 1,959.78913,889.8672
Script end 0.2702  5,849.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00431.5928200.0002
Check MTime0.00120.4554200.0001
Mysql Total
Database connection0.00070.251610.0007
Mysqli_queries0.174664.59391410.0012
Looping result0.00130.48721390.0000
Template Total0.248792.010.2487
Template load0.00070.254310.0007
Template processing0.248191.785810.2481
Override
Cache load0.00050.173210.0005
Sytem overhead
Fetch class attribute can translate value0.00190.696110.0019
XML
Image XML parsing0.00030.119910.0003
General
dbfile0.00853.1392200.0004
String conversion0.00000.001830.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs