Forums / Setup & design / Override templates used by attribute_view_gui ?

Override templates used by attribute_view_gui ?

Author Message

Reinhard Hutter

Thursday 08 May 2008 5:39:57 am

I want to override the templates which are used by attribute_view_gui for ezbinaryfile and ezurl. I've created the override template inside override/template of my siteaccess and I've added following section on top of my siteaccess' override.ini.append.php

[my_download]
Source=content/datatype/view/ezbinaryfile.tpl
MatchFile=my_file.tpl
Subdir=templates
Match[attribute_identifier]=ezbinaryfile

but I still do get the standard template. I've also tried

Match[class_identifier]=ezbinaryfile

and completly removing any Match[whatever], but no success at all. I still get the template
design/base/override/templates/datatype/ezbinaryfile.tpl
althoug it's listed with priority 2 and my own file is listed with priority 1. Any hints?

Thanks in advance
Reinhard

Pascal von Büren

Thursday 08 May 2008 7:39:09 am

Hi Reinhard,

could you please answer the following questions:

-You have cleared your caches (at least ini and override)
-Your new template is located in /design/your_design/override/templates/my_file.tpl
-either your ContentClass or attribute has the identifier "ezbinaryfile" (what I hardly believe, shouldn't this be more like "file"?)

Best wishes,
Pascal

Reinhard Hutter

Thursday 08 May 2008 8:48:04 am

Thanks for the answer, I've found a solution meanwhile.

The Match[] directives were a wrong approach, I wanted the override to be valid for any content class and any attribute name as long as the attribute datatype is "ezbinaryfile". So I had to remove the Match[] directive completly. Additionally, somewhere in the middle of override.ini.append.php there has been a block

[file_binaryfile]
Source=content/datatype/view/ezbinaryfile.tpl
MatchFile=datatype/ezbinaryfile.tpl
Subdir=templates

while my own block was located right at the beginning of the file. I simply moved my block to the end of the file, and now it works.

But there is either a bug in the admin backend ( /visual/templateview/content/datatype/view/ezbinaryfile.tpl ) or in the override system itself, because the admin backend now lists my block as prioriy 2 and it still overrules the [file_binaryfile] block with priority 1.

Pascal von Büren

Thursday 08 May 2008 8:51:39 am

You won't even need a rule for this approach. Simply put your new file in /design/your_design/templates/content/datatype/view/ezbinaryfile.tpl (basically the same place as the original, but in your own design), and template fallback will take care of the rest.

Try it out, works like a charm.

Reinhard Hutter

Thursday 08 May 2008 9:07:44 am

Ah, thanks for the hint, this is definitly a more elegant solution than mine. Worked fine for the "ezurl" datatype, for the "ezbinaryfile" I had to remove that other block pointing to the "base"-design which was added by default.

But I've to admit, I'm still unsure when to place template files into
/design/my_design/templates
and when to place them into
/design/my_design/override/templates

Pascal von Büren

Thursday 08 May 2008 9:19:56 am

This is a nice read concerning <b>fallbacks</b>:

http://ez.no/doc/ez_publish/technical_manual/4_0/concepts_and_basics/designs/design_combinations

And this one the same for <b>overrides</b>

http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_template_override_system

Citing from a comment there:

<i>The special thing with override templates is that they can *conditionally* override default templates, only if cetain conditions are met, like node id or object class, using the Match specifier.</i>

eZ debug

Timing: Jan 30 2025 00:18:59
Script start
Timing: Jan 30 2025 00:18:59
Module start 'content'
Timing: Jan 30 2025 00:18:59
Module end 'content'
Timing: Jan 30 2025 00:18:59
Script end

Main resources:

Total runtime0.1396 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.0625180.8125
Module start 'content' 0.00480.0056 768.875098.0547
Module end 'content' 0.01040.1292 866.9297527.1250
Script end 0.1396  1,394.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.4327200.0002
Check MTime0.00141.0150200.0001
Mysql Total
Database connection0.00050.325910.0005
Mysqli_queries0.097569.80331410.0007
Looping result0.00100.69591390.0000
Template Total0.128892.310.1288
Template load0.00080.592910.0008
Template processing0.128091.661010.1280
Override
Cache load0.00060.426110.0006
Sytem overhead
Fetch class attribute can translate value0.00070.489110.0007
XML
Image XML parsing0.00030.183210.0003
General
dbfile0.00926.5558200.0005
String conversion0.00000.002730.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs