Forums / Setup & design / Section template override

Section template override

Author Message

Mihai007 Pop

Wednesday 16 April 2008 8:14:50 am

Hi guys!

I am having a bit of a problem! I am sure it used to work this way! I have downloaded and installed a fresh new ez4.0.0

Now I create a section called Products and assigned to the frontpage called products! Everything underneath it is now part of this section.

Now I created a new node/view/full template and assigned it to class identifier "folder" and then section "products"! all using the admin interface. I also checked to see if it is under the correct site settings and it is. I also checked to see if i am browsing to the right site and not to eng for example.

When I now look at a folder under the frontpage called products, it still uses the full_folder.tpl. I checked it because I modified it a bit to see if it does and it does.

Now I cleared all caches, i even moved priorities, and I just down't know what else to do...! I need to apply a template to folders under a certain section. Am i doing something wrong or am I missing something???

Thank you in advance

P.S. i allowed anonymous to view the new section.

Maxime Thomas

Wednesday 16 April 2008 11:24:48 pm

Can you provide the override settings , please ?

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Mihai007 Pop

Thursday 17 April 2008 12:24:24 am

Okay - I have used the admin interface only to create a new template override! So I did not play with the override.ini.append.php file.

But here it's what's happening. I have a siteaccess called "aliman". Inside it there is this file called override.ini.append.php. I opened it and I found the following two things of interest to me:

[full_folder]
Source=node/view/full.tpl
MatchFile=full/folder.tpl
Subdir=templates
Match[class_identifier]=folder


[full_folder_products]
Source=node/view/full.tpl
MatchFile=full_folder_products.tpl
Subdir=templates
Match[class_identifier]=folder
Match[section]=6

The latter part (full_folder_products) was created using the admin interface. I clicked on design/templates/node/view/full.tpl. Here there is a whole bunch of templates for full product, article, etc...

Anyway so I clicked on "New Override" at the bottom.

Step 1. Here I chose extension "ezwebin". Okay I tried "no extension" as well but same result. Actually when I chose "ezwebin" I could no longer remove the file and it seems to look for it inside the root folder called design. It's like a mismatch somewhere.

Step 2. I gave it a filename: "full_folder_products"

Step 3. Class: I chose "Folder"

Step 4. Section: I chose "Products" This section I did inside setup/sections. I also assigned it to the frontpage called "Products" from the standard ez installation. I also checked that everything under this node is part of the "products" section which they are. I also gave anonymous user rights to view this new section.

Step 5. I chose a copy of the default template (I actually copied the content of the standard full_folder.tpl file...! I then modified it to add columns and so on...! I just want to represent all the products in a column format where the folder is for products. and the rest of the website to have the normal list display (one underneath each other one).... !

Now I tried removing all the templates, and so on...!

I made it work by doing the following:

Step 1. I went physically inside the folder :
\extension\ezwebin\design\ezwebin\override\templates\full

Step 2. I copied the file folder.tpl and called the new one folder_products.tpl where I implemented my column view

Step 3. I went inside the override.ini.append.php and copied the part where it says:

But here it's what's happening. I have a siteaccess called "aliman". Inside it there is this file called override.ini.append.php. I opened it and I found the following two things of interest to me:

[full_folder]
Source=node/view/full.tpl
MatchFile=full/folder.tpl
Subdir=templates
Match[class_identifier]=folder

and I made it be:

[full_folder]
Source=node/view/full.tpl
MatchFile=full/folder.tpl
Subdir=templates
Match[class_identifier]=folder

[full_folder]
Source=node/view/full.tpl
MatchFile=full_folder_products.tpl
Subdir=templates
Match[class_identifier]=folder
Match[section]=6

Now it works properly! I can now go to products and view a column layout, and I can go to a normal folder and view a normal list layout...!

But - it does not look right! I mean why must I go into the physical file system itself and modify? isn't the admin meant to do that???

And I have one big problem. I cannot acces the template for the standard folder view within the admin any more.

Can you help me, please? I hope this was as informative as possible :) I tried the docs and all! I am sure it used to work the way I described at the beginning.

Thank you in advance...

Yours Mihai

Maxime Thomas

Thursday 17 April 2008 10:43:38 pm

Hi,

What you can do to know if you have loaded the right template is to enable the debug for your siteacess an enable the list of templates.
At tehend of the debug you will have a table showing :
- what is asked
- what it is supposed to be loaded
- what is actually loaded
It's very usefull when you don't know what eZ really does.

Another point, you cannot have two override with the same name, they must have unique id (full_folder). The behavior of the override file is to load the first section settings it can find, so others sections with the same name are never loaded.

You may find more information here.

http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_template_override_system

As a rule of thumb, I suggest you to totally read the Concept and basics chapter of the online documentation. It contains a lot of important things.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas