Forums / Setup & design / Class Templates
Rob Clews
Tuesday 16 December 2003 7:03:09 am
Hi,
Is it possible to create a full page layout template dependant upon the class of the content you are viewing? I can only only seem to find examples of the main area but not headers/navigation etc.
CheersRob Clews
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=templatesMatch[class]=1
[my_pagelayout_for_articles] Source=pagelayout.tpl MatchFile=pagelayout_articles.tpl Subdir=templatesMatch[class]=2
I've not tried this but give it a go.
paul
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
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.
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=templatesMatch[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"
ThanksRob
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=templatesMatch[class]=17
Is your new file within:
design/<your-design>/override/templates ?
Are file permissions correct for this file?paul
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
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.