Share » Forums » Setup & design » Class Templates

Class Templates

Class Templates

Tuesday 16 December 2003 7:03:09 am - 7 replies

Author Message

Paul Forsyth

Tuesday 16 December 2003 7:22:39 am

It should as you can match by class. Have you tried something like this:

[my_pagelayout_for_folders]
Source=pagelayout.tpl
MatchFile=pagelayout_folders.tpl
Subdir=templates
Match[class]=1

[my_pagelayout_for_articles]
Source=pagelayout.tpl
MatchFile=pagelayout_articles.tpl
Subdir=templates
Match[class]=2

I've not tried this but give it a go.

paul

Rob Clews

Tuesday 16 December 2003 7:45:11 am

Paul, cheers, but I already have that and the template file, copied from another example, does not include all the html of the page, just the "main area" html. Or am I missing something here.

Basically I want a different page header dependant upon what the class is.

Rob

Paul Forsyth

Tuesday 16 December 2003 7:53:30 am

Well the main area is inserted via the

{$module_result.content}

command. The rest will be as specified in the pagelayout.

Do you have caching on? The layout may be being cached. Try clearing all caches to find if this is the problem.

An alternative path is to include the page top within each of your templates instead of the layout. This isn't quite as good as using a separate pagelayout but is a workaround.

Ill be surprised if the override solution doesn't work.

paul

Rob Clews

Tuesday 16 December 2003 8:10:38 am

Ahh, I see what it's doing now, heres what I have:

[pagelayout_for_my_class]
Source=pagelayout.tpl
MatchFile=newpagelayout.tpl
Subdir=templates
Match[class]=17

However on every page regardless of class I get the following in debug, with no html on the page other than the debug information:

Warning: eZTemplate Dec 16 2003 17:45:57

No template could be loaded for "pagelayout.tpl" using resource "design"

Thanks
Rob

Paul Forsyth

Tuesday 16 December 2003 9:33:20 am

Hmm, at least its looking for the file.

Try to make the group heading the same as the template name. I think my example was wrong. Thought im not 100% this needs to be done, but its worth a try:

[newpagelayout]
Source=pagelayout.tpl
MatchFile=newpagelayout.tpl
Subdir=templates
Match[class]=17

Is your new file within:

design/<your-design>/override/templates ?

Are file permissions correct for this file?
paul

Rob Clews

Wednesday 17 December 2003 3:19:40 am

Ok, the ini setting is as you've stated, and the permissions are 666, owner www (apache user).

Still get the same problem! Is it possible to override pagelayout.tpl?

Thanks

Paul Forsyth

Wednesday 17 December 2003 4:14:35 am

It is possible. Look at the file:

settings/siteaccess/demo/override.ini.append

It has loads of pagelayout overrides in there.

Are you sure you are clearing the cache? Remove everything in var/cache if in doubt.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu