Forums / Developer / Override one part of a class, leaving untouched the other part

Override one part of a class, leaving untouched the other part

Author Message

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

Zoltan Szabo

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

Zoltan Szabo

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...

Bård Farstad

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.

--bård

Documentation: http://ez.no/doc

eZ debug

Timing: Jan 14 2025 21:02:16
Script start
Timing: Jan 14 2025 21:02:16
Module start 'content'
Timing: Jan 14 2025 21:02:17
Module end 'content'
Timing: Jan 14 2025 21:02:17
Script end

Main resources:

Total runtime0.8459 sec
Peak memory usage8,192.0000 KB
Database Queries198

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 688.9766214.7578
Module start 'content' 0.00730.7328 903.73441,890.6406
Module end 'content' 0.74020.1057 2,794.3750635.4531
Script end 0.8458  3,429.8281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00750.8875210.0004
Check MTime0.00170.1988210.0001
Mysql Total
Database connection0.00110.129610.0011
Mysqli_queries0.756189.38381980.0038
Looping result0.00160.18421950.0000
Template Total0.818296.720.4091
Template load0.00400.475420.0020
Template processing0.814296.252220.4071
Template load and register function0.00150.180210.0015
states
state_id_array0.00120.146910.0012
state_identifier_array0.00060.075720.0003
Override
Cache load0.00370.4397340.0001
Sytem overhead
Fetch class attribute can translate value0.00140.166240.0004
Fetch class attribute name0.00230.273880.0003
XML
Image XML parsing0.00120.138640.0003
class_abstraction
Instantiating content class attribute0.00000.002090.0000
General
dbfile0.00100.1127290.0000
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs