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.

eZ debug

Timing: Jan 18 2025 21:01:13
Script start
Timing: Jan 18 2025 21:01:13
Module start 'layout'
Timing: Jan 18 2025 21:01:13
Module start 'content'
Timing: Jan 18 2025 21:01:14
Module end 'content'
Timing: Jan 18 2025 21:01:14
Script end

Main resources:

Total runtime1.2019 sec
Peak memory usage4,096.0000 KB
Database Queries55

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.1797152.6406
Module start 'layout' 0.00600.0026 741.820339.4766
Module start 'content' 0.00871.1917 781.2969441.2656
Module end 'content' 1.20030.0015 1,222.562512.1250
Script end 1.2019  1,234.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2815160.0002
Check MTime0.00130.1093160.0001
Mysql Total
Database connection0.00110.089210.0011
Mysqli_queries1.154796.0694550.0210
Looping result0.00050.0455530.0000
Template Total1.166997.120.5835
Template load0.00220.187020.0011
Template processing1.164796.899720.5823
Template load and register function0.00020.020210.0002
states
state_id_array0.00080.069610.0008
state_identifier_array0.00070.060720.0004
Override
Cache load0.00190.1547230.0001
Sytem overhead
Fetch class attribute can translate value0.00220.184310.0022
Fetch class attribute name0.00140.117330.0005
XML
Image XML parsing0.00010.009710.0001
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00070.0570100.0001
String conversion0.00000.000640.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/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: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs