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.