eZ Community » Forums » Install & configuration » Template language question
expandshrink

Template language question

Template language question

Sunday 23 March 2003 11:02:42 am - 7 replies

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?

Sunday 23 March 2003 11: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

Monday 24 March 2003 5:13:54 am

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>

Monday 24 March 2003 5:14:20 am

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}

Monday 24 March 2003 5:15:51 am

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>

Monday 24 March 2003 5:33:31 am

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>

Monday 24 March 2003 5:33:54 am

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.)

Monday 24 March 2003 5:58:02 am

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

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from