User managed use of template

User managed use of template

Monday 07 April 2008 7:50:39 am - 2 replies

Author Message

Mark Marsiglio

Monday 07 April 2008 12:51:19 pm

We did this by adding an attribute to the folder class that is a Select, with three choices. 1) Don't Show Children, 2) Show Children, 3) Shown Children and Grandchildren. Then this is our template code for the display of children in full/folder.tpl:

{def  $include_classes=array('section_home', 'folder', 'calendar', 'article','faq_list','feedback_form','file','link')
	$my_children=fetch('content', 'list', hash('parent_node_id', $node.object.main_node_id, 'class_filter_type', 'include', 'class_filter_array', $include_classes, sort_by, $node.sort_array ))
	$kidshowset=$node.data_map.show_children.content.0
	$url_string=''
	$short_text_at=array()}
{if gt($my_children|count, 0)}
<div class='showsubitems'>
{/if}
    {if and(gt($my_children|count, 0), ne($kidshowset,0) )}
	{section var=this_child loop=$my_children}
	{if ne(24, $this_child.object.section_id)}

	   {set url_string=and(is_set($this_child.data_map.link), is_set($this_child.data_map.url), $this_child.data_map.link.data_int)|choose(fetch(content, node, hash(node_id, $this_child.object.main_node_id)).url_alias|ezroot(no),$this_child.data_map.url.content|ezroot(no))
		  short_text_at = first_set($this_child.object.data_map.short_description, $this_child.object.data_map.summary ,$this_child.object.data_map.intro, $this_child.object.data_map.answer, false())}

	   {if gt($kidshowset,1)}

	   {if $short_text_at.has_content}
	   <h2><a href='{$url_string}'>{first_set($this_child.data_map.namelong.content,$this_child.name)|wash}</a></h2>

{/if}
	   
	   {let grand_children=fetch('content', 'list', hash(parent_node_id, $this_child.object.main_node_id, sort_by, $this_child.sort_array, class_filter_type, 'include', 'class_filter_array', $include_classes))}
		<ul class='sectionhomesubitems'>
		{foreach $grand_children as $this_grandchild}
		   {if ne(24, $this_grandchild.object.section_id)}
	     	   {set url_string=and(is_set($this_grandchild.data_map.link), is_set($this_grandchild.data_map.url), $this_grandchild.data_map.link.data_int)|choose($this_grandchild.url_alias|ezroot(no),$this_grandchild.data_map.url.content|ezroot(no))}
		   <li><a href='{$url_string}'>{$this_grandchild.name|wash}</a></li>
		   {delimiter}|{/delimiter}
		   {/if}
		{/foreach}
		</ul>
	   {/let}

	   {else}

	   <h2><a href='{$url_string}'>{$this_child.name|wash}</a></h2>
 	   <div class="divdesc-perm">{attribute_view_gui attribute=$short_text_at}</div>

	   {/if}
	{/if}
	{/section}
    {/if}
{if gt($my_children|count, 0)}
</div>
{/if}
{undef}

--WARNING - I did not clean out some site specific stuff in this code that you might be able to safely remove because it dealt with a specific section override on our site.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Etienne Jolivet

Tuesday 08 April 2008 5:01:17 am

Thank you for your answer!

I was hoping that maybe eZ offered something to do this with configuration files... Too bad :)

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

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