Forums / Install & configuration / Template language question

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