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 31 2025 16:59:23
Script start
Timing: Jan 31 2025 16:59:23
Module start 'content'
Timing: Jan 31 2025 16:59:24
Module end 'content'
Timing: Jan 31 2025 16:59:24
Script end

Main resources:

Total runtime1.1703 sec
Peak memory usage6,144.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 676.8984214.7656
Module start 'content' 0.00631.0459 891.66411,831.1406
Module end 'content' 1.05220.1180 2,722.8047581.8281
Script end 1.1702  3,304.6328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00730.6199210.0003
Check MTime0.00150.1316210.0001
Mysql Total
Database connection0.00070.061610.0007
Mysqli_queries1.070191.43842050.0052
Looping result0.00160.13302030.0000
Template Total1.140497.520.5702
Template load0.00350.300720.0018
Template processing1.136997.149820.5684
Template load and register function0.00130.109210.0013
states
state_id_array0.00160.140910.0016
state_identifier_array0.00140.119220.0007
Override
Cache load0.00310.2678340.0001
Sytem overhead
Fetch class attribute can translate value0.00090.077940.0002
Fetch class attribute name0.00230.194680.0003
XML
Image XML parsing0.00140.118440.0003
class_abstraction
Instantiating content class attribute0.00000.001490.0000
General
dbfile0.00480.4142350.0001
String conversion0.00000.000530.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