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>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 21:15:28
Script start
Timing: Jan 30 2025 21:15:28
Module start 'layout'
Timing: Jan 30 2025 21:15:28
Module start 'content'
Timing: Jan 30 2025 21:15:28
Module end 'content'
Timing: Jan 30 2025 21:15:28
Script end

Main resources:

Total runtime0.0245 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.2656151.2266
Module start 'layout' 0.00470.0039 739.4922220.7188
Module start 'content' 0.00860.0142 960.21091,001.9609
Module end 'content' 0.02280.0017 1,962.171937.9922
Script end 0.0245  2,000.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002811.4981140.0002
Check MTime0.00104.1856140.0001
Mysql Total
Database connection0.00072.996410.0007
Mysqli_queries0.00187.537330.0006
Looping result0.00000.033110.0000
Template Total0.00125.010.0012
Template load0.00093.649410.0009
Template processing0.00031.302110.0003
Override
Cache load0.00062.440710.0006
General
dbfile0.00166.422080.0002
String conversion0.00000.032140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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