create a view of a instense's list of a class

Author Message

alberic briot

Thursday 27 December 2007 6:30:24 am

Hello,

I would like to had to the pagelayout.tpl a list of object well presented and I would like thats easy top add or change object with the administation interface. So I created a class (CommercialLink) and then I created instense of my class in a folder hidden (/file/commercial_link). I also overide the full.tpl for my class.

Now, I would like to know, how to insert the list of instense of my class wich is in my folder.

thank you,
Alberic.

alberic briot

Thursday 27 December 2007 9:36:09 am

I progress but the problem is still here. I added an "Object relations" to the "Template look" class wich I called commercial_link_list. Then in the "Design -> Look and Feel" I added my Object I have created in the folder.

But, now I can't get the object in the pagelayout.tpl. I'm barely sure that it miss just a piece of code. I get whith this folowing code a ezcontentobjectattribute:

  {$pagedesign.data_map.commercial_links_list.content}

How can I get his attribute contentobject_id and then the object and better the attribute of the object.

There is two solution I think
- using the template of my class
- re-editing the template

I tell to the Object relations to use the template way but it doesn't seem to use it.

alberic briot

Thursday 03 January 2008 5:19:04 am

Finaly, I managed to solve my problem. With this piece of code in my pagelayout.tpl.

{def $nodes=fetch( 'content', 'list',
	hash( 'parent_node_id', 172,
		sort_by, array( array( name, false() ),
		array( published, false() ) ),
		'class_filter_type',  'include',
		'class_filter_array', array( 'comerciallink' ) ) )}
	{foreach $nodes as $node}
		<div class="comercial-link">
                   <a href="{attribute_view_gui attribute=$node.object.data_map.href}">
			<h2>{attribute_view_gui attribute=$node.object.data_map.title_label}</h2>
                   </a>
	        </div>

	{/foreach}
{undef $nodes}

NB: 172 is the node_id wich I found in the "content structure".
There was too a problem because the folder containing the instances of my class was hidden so I unhide it.

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