rendering of a personnalized object

Author Message

phil lem

Friday 03 April 2009 7:07:35 am

Hello,

i'm a newbie in ezpublish and i need some help to render a personnalized object
i have created.

My object has 3 attributes

I have instanciate it twice and i've published it.

I tried to create an override.ini.append.php file containing :

[widget]
Source=node/view/full.tpl
MatchFile=abstract.tpl
Subdir=templates
Match[class_identifier]=widget

----------------------------------------------------

in my tpl file i list the widgets but i don't obtain the render of the widget stored in a tpl ...

{def $widgets=fetch( 'content', 'list', hash(
'parent_node_id', 2,
'class_filter_array', array( 'widgetPLE' ),
) )}

<ul>

{foreach $widgets as $widget}

<li>{content_view_gui view=full content_object=$widget.data_map.content}
</li>

{/foreach}

</ul>

do u have un idea ?

thanks,

brgds,

philippe

PS : sorry for my bad level in english ;)

justin kazadi

Friday 03 April 2009 7:37:38 am

Hi,
i think you have an error on your fetch function.

you have write this :

{def $widgets=fetch( 'content', 'list', hash(
'parent_node_id', 2,
'class_filter_array', array( 'widgetPLE' ),
) )}

but you don't specify the

class_filter_type 

parameter in your fetch
and your

class_filter_array
 have 
array('WidgetPLE')  as value

which is not the same with your identifier class in override.

[widget]
Source=node/view/full.tpl
MatchFile=abstract.tpl
Subdir=templates
Match[class_identifier]=widget

so try this code :

{def $widgets=fetch('content','list',hash('parent_node_id',2,
                                                        'class_filter_type',include,
                                                        'class_filter_array',array('widget')
                                                      )
                           )
}
and had your foreach

i think this can help you.

good luck

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

phil lem

Friday 03 April 2009 8:25:20 am

in fact it's not an error // my code is good according to this comment

fyi, my script gather information from database !!!

obviously, my class is called widgetPLE and not widget
it was an example ..

i reach informations but it's not well formed.

- is the template script good ?
- is the mapping seems to be good ?
- do u think i have to set the source in the overrive file to : "node/view/full.tpl"

i have no error but the render is bad ...

an other idea ? :)

justin kazadi

Friday 03 April 2009 9:13:26 am

Hi,
with your code

{def $widgets=fetch( 'content', 'list', hash(
'parent_node_id', 2,
'class_filter_array', array( 'widgetPLE' ),
) )}


the system don't know if it must select the nodes with widget " class" or not.
so with your fetch the system will reach the node with any class and who have

2

as parent.
so you must add the

class_filter_type

parameter in your fetch to restric the selection to only the class "widget"

do understand?

i think this can help you.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

phil lem

Monday 06 April 2009 5:14:13 am

thank you for your reply justin

in fact i had not very well understood why class_filter_type were important ...

but it get informations from database !!

>> my main problem still is how to set a personnal render to a personnal class ...

i list informations but whitout the tpl style,

brgds,

phil

justin kazadi

Monday 06 April 2009 6:47:04 am

Hi,
if you have store your style (class,id) in an css file
verify that the path to your css file is correct. to perform it , make see the source code on your browser.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

phil lem

Monday 06 April 2009 8:13:11 am

re ...

the problem is not in CSS ...

when i list objets ... i wan't objects to be rendered thanks to the template linked in the
override.ini.append.php. - i'd like to list element and each element would be rendered with the abstract.tpl file !
....
the code i have inserted in this post is running except the visual part ...

my result is :

" Current version

Related objects
None "

justin kazadi

Monday 06 April 2009 9:09:20 am

Hi,
you says that:

when i list objets ... i wan't objects to be rendered thanks to the template linked in the
override.ini.append.php. - i'd like to list element and each element would be rendered with the abstract.tpl file !

we can go step by step :

1.do you know if the system find your override template ?

enabled the debug on your web site so you can know if your override template is find by the system.
to enabled the debug add these lines in your site.ini.append.

[DebugSettings]
DebugOutput=enabled
DebugRedirection=disabled

[TemplateSettings]
ShowXHTMLCode=disabled
ShowUsedTemplates=enabled

 

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

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 31 2025 01:22:05
Script start
Timing: Jan 31 2025 01:22:05
Module start 'layout'
Timing: Jan 31 2025 01:22:05
Module start 'content'
Timing: Jan 31 2025 01:22:06
Module end 'content'
Timing: Jan 31 2025 01:22:06
Script end

Main resources:

Total runtime1.3179 sec
Peak memory usage8,192.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.2500151.2266
Module start 'layout' 0.00610.0047 739.4766220.7031
Module start 'content' 0.01071.3063 960.17974,531.5313
Module end 'content' 1.31700.0009 5,491.710919.8438
Script end 1.3179  5,511.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.2977160.0002
Check MTime0.00130.0987160.0001
Mysql Total
Database connection0.00080.058510.0008
Mysqli_queries1.179789.5130720.0164
Looping result0.00090.0668700.0000
Template Total1.260895.720.6304
Template load0.00210.158420.0010
Template processing1.258795.509120.6294
Template load and register function0.00200.148910.0020
states
state_id_array0.00270.205410.0027
state_identifier_array0.00230.174420.0011
Override
Cache load0.00200.15451080.0000
Sytem overhead
Fetch class attribute can translate value0.00220.163520.0011
Fetch class attribute name0.00220.170490.0002
XML
Image XML parsing0.00270.204120.0013
class_abstraction
Instantiating content class attribute0.00000.0026120.0000
General
dbfile0.00260.2009160.0002
String conversion0.00000.000740.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
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
27content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
16content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
10content/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: 67
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs