Template language question

Author Message

mikle mikle

Sunday 23 March 2003 2:02:42 am

Hay, i have the following problem- on my site tree i have a folder, lets say FOLDER1, and articles inside it. Now i want that anybody who clicks on the FOLDER1 link go not to the folder page, but to the page with full view of first element of the folder. I think i could do this with URL translation but this isn't what i want (anyway i didn't find how to setup url translation - there only options to enable translation in site.ini, but no example), i'd rather setup template for class FOLDER1, so that it call full view of the first child object. In other words- is there a function a way to call an object's full view?

Paul Borgermans

Sunday 23 March 2003 2:25:08 pm

> Hay, i have the following problem- on my site tree i have a
> folder, lets say FOLDER1, and articles inside it. Now i want
> that anybody who clicks on the FOLDER1 link go not to the
> folder page, but to the page with full view of first element
> of the folder. I think i could do this with URL translation
> but this isn't what i want (anyway i didn't find how to
> setup url translation - there only options to enable
> translation in site.ini, but no example), i'd rather setup
> template for class FOLDER1, so that it call full view of the
> first child object. In other words- is there a function a
> way to call an object's full view?

The concept of a folder now applies to any object class. So why not make article1 the "folder" and the rest children of these? You only may want to change the "line" template for your article class if the defaults are not good enough

Another option may be to make an override template for the specific node which gets the node id, fetches the first child and displays it (not sure about how to accomplish the last step without duplicating the template of the article in this node override template).

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Kai Duebbert

Sunday 23 March 2003 8:13:54 pm

I think I understood what you mean and we did something similiar:

<pre>
{* See, if we are in the top directory and if we should show our frontpage! *}
{section show=eq(2,$node.node_id)}
{include uri="design:page_frontpage.tpl"}
{section-else}
{* If we have only one article, then show it full! *}
{switch name=decision match=$articles_count}
{case match=1}
{section name=Article loop=$articles}
{node_view_gui view=full content_node=$decision:Article:item}
{/section}
{/case}
{case}
{section name=Article loop=$articles}
<h3>{$decision:Article:item.name}</h3>
{$decision:Article:item.data_map.intro.data_text}<br /><br />
{section name=read_link show=$decision:Article:item.contentobject_version_object.data_map.body}
<a href={concat("/content/view/full/",$decision:Article:item.node_id)|ezurl}>Read more...</a>
{/section}
<hr />
{/section}
{/case}
{/switch}
{/section}
</pre>

Kai Duebbert

Sunday 23 March 2003 8:14:20 pm

I think I understood what you mean and we did something similiar:

{* See, if we are in the top directory and if we should show our frontpage! *}
{section show=eq(2,$node.node_id)}
	{include uri="design:page_frontpage.tpl"}
{section-else}
	{* If we have only one article, then show it full! *}
	{switch name=decision match=$articles_count}
	{case match=1}
		{section name=Article loop=$articles}
			{node_view_gui view=full content_node=$decision:Article:item}
		{/section}
	{/case}
	{case}
		{section name=Article loop=$articles}
			<h3>{$decision:Article:item.name}</h3>
			{$decision:Article:item.data_map.intro.data_text}<br /><br />
			{section name=read_link show=$decision:Article:item.contentobject_version_object.data_map.body}
				<a href={concat("/content/view/full/",$decision:Article:item.node_id)|ezurl}>Read more...</a>
			{/section}
			<hr />
		{/section}
	{/case}
	{/switch}
{/section}

Kai Duebbert

Sunday 23 March 2003 8:15:51 pm

I think I understood what you mean and we did something similiar:

<quote>
{* See, if we are in the top directory and if we should show our frontpage! *}
{section show=eq(2,$node.node_id)}
{include uri="design:page_frontpage.tpl"}
{section-else}
{* If we have only one article, then show it full! *}
{switch name=decision match=$articles_count}
{case match=1}
{section name=Article loop=$articles}
{node_view_gui view=full content_node=$decision:Article:item}
{/section}
{/case}
{case}
{section name=Article loop=$articles}
<h3>{$decision:Article:item.name}</h3>
{$decision:Article:item.data_map.intro.data_text}<br /><br />
{section name=read_link show=$decision:Article:item.contentobject_version_object.data_map.body}
<a href={concat("/content/view/full/",$decision:Article:item.node_id)|ezurl}>Read more...</a>
{/section}
<hr />
{/section}
{/case}
{/switch}
{/section}
</quote>

Kai Duebbert

Sunday 23 March 2003 8:33:31 pm

I think I understood what you mean and we did something similiar. I've put it into the ezwiki so formatting is nicer.

Have a look at <link http://ezwiki.blanko.info/index.php/3XHT_OneArticleFolder http://ezwiki.blanko.info/index.php/3XHT_OneArticleFolder>

Kai Duebbert

Sunday 23 March 2003 8:33:54 pm

I think I understood what you mean and we did something similiar. I've put it into the ezwiki so formatting is nicer.

Have a look at http://ezwiki.blanko.info/index.php/3XHT_OneArticleFolder

I love the new template system! In the old eZ publish we had to edit the code for functionality like this which made it really difficult to upgrade. The advantage is that building the site is much better if you use categories and just one article in them. Keeps it very flexible compared to direct linking to articles.

(Now, only getting the articles is still far too database intensive I think. Caching of results should be (and hopefully will be) used. But that's a different topic.)

mikle mikle

Sunday 23 March 2003 8:58:02 pm

Thanks a lot! It is exactly what i need!!!
Best regards, Michael

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

eZ debug

Timing: Jan 18 2025 11:42:08
Script start
Timing: Jan 18 2025 11:42:08
Module start 'layout'
Timing: Jan 18 2025 11:42:08
Module start 'content'
Timing: Jan 18 2025 11:42:09
Module end 'content'
Timing: Jan 18 2025 11:42:09
Script end

Main resources:

Total runtime0.6773 sec
Peak memory usage4,096.0000 KB
Database Queries74

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 588.0313152.6406
Module start 'layout' 0.00770.0032 740.671939.4609
Module start 'content' 0.01100.6649 780.1328635.8047
Module end 'content' 0.67590.0014 1,415.937520.1641
Script end 0.6773  1,436.1016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4768160.0002
Check MTime0.00130.1974160.0001
Mysql Total
Database connection0.00100.145410.0010
Mysqli_queries0.603489.0864740.0082
Looping result0.00070.1062720.0000
Template Total0.639194.420.3195
Template load0.00220.320220.0011
Template processing0.636994.028520.3184
Template load and register function0.00020.033210.0002
states
state_id_array0.00080.123110.0008
state_identifier_array0.00100.146820.0005
Override
Cache load0.00210.3076890.0000
Sytem overhead
Fetch class attribute can translate value0.00060.093530.0002
Fetch class attribute name0.00100.149690.0001
XML
Image XML parsing0.00110.168830.0004
class_abstraction
Instantiating content class attribute0.00000.001990.0000
General
dbfile0.00100.1406170.0001
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs