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.