Forums / Developer / Override one part of a class, leaving untouched the other part
Zoltan Szabo
Wednesday 11 August 2004 11:25:12 am
I would like to make a template file for a pagelayout where there are different xml parts of the class I want to show.
There are some multi-line menupoints (let's call them menu) and there is a big article also in the same class (let's call it bigtext).Both of them are xml texts.
I don't want the menupoints to get closed into PARAGRAPH-s, but it's the builtin feature of an xml text. I would like to override the paragraph.tpl in "ezxmltags" directory, but only for the "menu" part of my class, and not the "bigtext" parts. How to do it?
Paul Borgermans
Wednesday 11 August 2004 11:37:08 am
That is a nice feature request: override on class-attribute instead of on class for datatypes. Do it (post as an enhancement in the bug reports)!
However, in your case, i would use a normal text field for creating the menus. With some clever string operations (non-xml), you may achieve what you need.
-paul
eZ Publish, eZ Find, Solr expert consulting and training http://twitter.com/paulborgermans
Wednesday 11 August 2004 9:53:13 pm
Is it possible to make a workaround for the class-attribute level override this way?
Inside the paragraph.tpl the code could detect the name of the caller class-attribute (via a section - section-else condition)...
{section show=WE_ARE_CALLED_FOR_A_MENUPOINT} {$content} {section-else} <p> {$content} </p> {/section}
Bård Farstad
Thursday 12 August 2004 12:14:09 am
You can do an override of the template using the key attribute_identifier. This means that you will create a new template for paragraph which only will be used if e.g. the attribute_identifier=menu.
The override settings is set in override.ini. The name of the attribute_identifier is found when you view your class.
--bård
Documentation: http://ez.no/doc
Thursday 12 August 2004 1:05:36 am
Thank you! success!!Match[attribute_identifier] is great...
By the way: if I am a freshman, how can I find the relevant part of the php code, where the acceptable Match[... ] values take place? Some rgreps in the kernel directory? Or some print_r-s in the index.php? ...
Is there some elegant way to see, what variable-s can be seen from a template.tpl file?I mean something like http://ez.no/ez_publish/documentation/customization/custom_design/template_variables_set_by_ezpublish ,but without having to known this kind of specialities of eZp...
Thursday 12 August 2004 4:57:03 am
Great that it works.
If you would like to get all the override keys which are used you need to add a var_dump($matchKeys) in kernel/common/eztemplatedesignresource.php at line 344. That might be too much information, but atleast you will get all keys used.
No, there is currently no elegant way of seeing all available template variables.