Forums / General / Problems with template overrides in 3.1

Problems with template overrides in 3.1

Author Message

Tobias Reifenberger

Thursday 14 August 2003 2:12:45 am

I have a problems with the template overriding system while migrating a site from 3.0 to 3.1.

All overrides are in the directory
design/default/override/templates/node/view/

After switching to 3.1 and getting a not working site, I had to realize that the automatic template overriding system was gone. With the minimal documentation floating around in the forum I created the required configuration file.

And - its still not working. Then I played with the different parameters without any result. (Yes cache is cleared, etc.) This is a real pain...

Any hints? Is there any 'compat 3.0' mode available?

[settings/siteaccess/default/override.ini.append]
...
[full_node_47]
Source=node/view/full.tpl
MatchFile=full_node_47.tpl
Subdir=templates
Match[node]=47

[full_class_1]
Source=node/view/full.tpl
MatchFile=full_class_1.tpl
Subdir=templates
Match[class]=1

[line_class_1]
Source=node/view/line.tpl
MatchFile=line_class_1.tpl
Subdir=templates/node/view
Match[class]=1
...

bye es tnx

Tony Wood

Thursday 14 August 2003 2:35:25 am

Hi,

Have you seen http://ez.no/developer/ez_publish_3/documentation/customization/custom_design/override_templates
Its a good document for overrides.

I hope this helps

tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Tobias Reifenberger

Thursday 14 August 2003 4:11:58 am

Thanks for the hint. But still no luck

The following section of my override file (I tried node/view and content/view) produces the php code below. Seems correct to me but it has no effect.

Any ideas what's goin' wrong?

...
[full_node_47]
Source=content/view/full.tpl
MatchFile=node/view/full_node_47.tpl
Subdir=templates
Match[node]=47
...

...
else if ( $matchFile == "/content/view/full.tpl" )
{
if ( $matchKeys['node'] == '47' )
{
return 'design/default/override/templates/node/view/full_node_47.tpl';
}
return 'design/standard/templates/content/view/full.tpl';
}
...

bye

Tristan Koen

Thursday 14 August 2003 5:04:40 am

Hi Tobias,

[full_node_47]
Source=content/view/full.tpl
MatchFile=node/view/full_node_47.tpl
Subdir=templates
Match[node]=47

should read (probably; I don't know what you are trying to override. For now, I'll assume it is an article).

[full_node_47]
Source=node/view/full.tpl (not content/view/full.tpl)
MatchFile=node/view/full_node_47.tpl
Subdir=templates
Match[node]=47

The best way to find out what you should be overriding is by setting template debugging to 'enabled'.
In your settings/siteaccess/yoursite/site.ini.append you need the code
[TemplateSettings]
Debug=enabled.
Ensure that this is not being overridden by a similar setting in settings/override/site.ini.append.php

You can then see exactly which templates are being called at each stage of page rendering.

Making changes to your override.ini doesn't mean that they will automatically take effect. You *NEED* to clear the ini cache. This can be done via the admin interface (setup->cache). I prefer to just delete my entire cache directory /var/cache.

Once the ini cache has been sorted out, it should work perfectly.

Tobias Reifenberger

Thursday 14 August 2003 6:13:45 am

Thanks Tony, Thanks Tristan

With the document mentioned by Tony and after Tristan's "rm -r var/cache/*" tip, the templates are now correctly used.

BTW: It seems that the 'Clear XYZ-Cache' buttons in the setup interface won't clear the cache sufficiently. Maybe someone should add extra vacuum-power in this module. :)

bye

Christian Lundvang

Wednesday 03 September 2003 5:33:48 am

One important notice!
Override of a certain node must be above classoverrides in the override.ini.append-file.

Example 1. Will work:

[full_node_2]
Source=node/view/full.tpl
MatchFile=node/view/full_node_2.tpl
Subdir=templates
Match[node]=2

[full_class_1]
Source=node/view/full.tpl
MatchFile=node/view/full_class_1.tpl
Subdir=templates
Match[class]=1

Example 2. Will NOT work:

[full_class_1]
Source=node/view/full.tpl
MatchFile=node/view/full_class_1.tpl
Subdir=templates
Match[class]=1

[full_node_2]
Source=node/view/full.tpl
MatchFile=node/view/full_node_2.tpl
Subdir=templates
Match[node]=2

In both examples full_node_2.tpl is an folder.

--
Best Regards
Christian Lundvang
http://www.nxc.no