Forums / Setup & design / [SOLVED] Display only 1 latest news post on home page?

[SOLVED] Display only 1 latest news post on home page?

Author Message

Nathan Kelly

Saturday 10 September 2005 12:41:37 am

Hi all, I'm setting up my home page as per: http://ez.no/community/forum/setup_design/object_relation_question

Basically I need to fetch the most recently published news article from the news section so I have done the following (This is the only way I have found that looks like what I need).

{def $recent_news=fetch('content', 'list',
			hash('parent_node_id', 70,
		    		'limit', 1,
				'class_filter_type', include,
				'class_filter_array', array('article'),
				'sort_by', array('published', false() ) ) )}

...Not sure what to put here...

{undef}

But I keep getting errors with the output, the article wont show up?

I have tried all sorts of variations of the node_view_gui method, can anyone suggest either a better way to do this, or an alternative to node_view_gui?

Cheers!

Pardon me while I burst into flames...

Gabriel Ambuehl

Saturday 10 September 2005 12:47:03 am

What does a
{$recent_news | attribute(show)}

yield.

Visit http://triligon.org

Kristof Coomans

Saturday 10 September 2005 4:56:29 am

{if $recent_news|count|gt(0)}
    {node_view_gui view='line' content_node=$recent_news.0}
{/if}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Nathan Kelly

Sunday 11 September 2005 4:14:21 pm

Thankyou once again Kristof recent news article is now showing up perfectly.

Cheers!!

Pardon me while I burst into flames...

Nathan Kelly

Sunday 11 September 2005 8:32:12 pm

Ahh, that said I now face another problem...

In my news section (section 7, node 70) I have my articles displaying in a shortened format with image, title, date, shortened intro and read more link. This uses the article.tpl located in: mydesign/override/templates/line/article.tpl

On my home page (section 6, node 2) I would like to omit the image and date whilst adding a "Recent News" header, so I have made a new home_article.tpl and placed it in: mydesign/override/templates/line/home_article.tpl

I have set my overrides as follows: -

[home_article_line]
Source=line/article.tpl
MatchFile=line/home_article.tpl
Subdir=templates
Match[class_identifier]=article
Match[section]=6

[article_line]
Source=node/view/line.tpl
MatchFile=line/article.tpl
Subdir=templates
Match[class_identifier]=article

But my article_line override is still taking precedence over my home_article_line.

What I have tried and failed:
1. Using node/view/line.tpl as Source template
2. Adding Match[node]=2
3. Matching [article_line] to section 7
3. Changing the directory of my home_article.tpl
4. Changing the order of the overrides within override.ini.append.php
5. And many more variations + clearing cache constantly.

Debug output shows no errors, I also have "list of used templates" enabled, it shows that the requested .tpl is line/article.tpl and the used template is the same. However with some configurations it shows that no template is requested or used, though the rendered output would suggest it is in-fact using the line/article.tpl

Is it possible to override an existing override or am I simply barking up the wrong tree?

Can anyone suggest what may be the problem and how I may overcome it?

I havn't had any trouble with overrides until now; all of my other overrides have worked as expected.

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Sunday 11 September 2005 10:29:05 pm

[SOLVED]

It seems that there is no way to override the existing article override so I found a new solution that seems to do the trick.

In my home page template I have changed the reference to the view template to use: -

From - {node_view_gui view='line' content_node=$recent_news.0}

To - {node_view_gui view='home_article' content_node=$recent_news.0}

And then placed my home_article.tpl in: mydesign/override/templates/node/view/home_article.tpl

This means I dont need to set and override in override.ini.append.php, in this case I think this is a suitable solution.

Cheers!

Pardon me while I burst into flames...

eZ debug

Timing: Jan 19 2025 06:16:03
Script start
Timing: Jan 19 2025 06:16:03
Module start 'content'
Timing: Jan 19 2025 06:16:04
Module end 'content'
Timing: Jan 19 2025 06:16:04
Script end

Main resources:

Total runtime0.8182 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.1797180.8125
Module start 'content' 0.00640.6811 769.9922625.4609
Module end 'content' 0.68740.1307 1,395.4531341.0547
Script end 0.8181  1,736.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.5506210.0002
Check MTime0.00160.2014210.0001
Mysql Total
Database connection0.00080.091910.0008
Mysqli_queries0.730689.29722050.0036
Looping result0.00190.23812030.0000
Template Total0.793196.920.3965
Template load0.00210.261820.0011
Template processing0.790996.664820.3955
Template load and register function0.00010.010510.0001
states
state_id_array0.00090.106610.0009
state_identifier_array0.00090.115020.0005
Override
Cache load0.00180.2219500.0000
Sytem overhead
Fetch class attribute can translate value0.00180.217040.0004
Fetch class attribute name0.00140.167980.0002
XML
Image XML parsing0.00150.184540.0004
class_abstraction
Instantiating content class attribute0.00000.0026110.0000
General
dbfile0.00680.8366330.0002
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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/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: 28
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs