Forums / Setup & design / create a new template for a single folder in a single node?

create a new template for a single folder in a single node?

Author Message

christian bencivenni

Monday 12 March 2007 8:53:01 am

Hi.
As described in the Title I have the need to create a personalized template for a single folder in a single node of the content tree.
Specifically I have to add a "create new object" button for the single (and only) folder.
I try in this way:

1. I enter as admin in the admin interface
2. click on Modify button of the selected folder in the content tree view
3. click on the folder Icon and, in the new menu, select "new node override template"
4. then select the <FrontEnd Site access>

At this point a new window is open in the template folder.
I add:

5. the name of the new template
6. select the override key: folder
7. All sections
8. IDnode left as indicated
9. select Template based on View without childer

Then I open the new template and it is right this:

<h1>{$node.name}</h1>

<h2>Name</h2>
{attribute_view_gui attribute=$node.object.data_map.name}

<h2>Short name</h2>
{attribute_view_gui attribute=$node.object.data_map.short_name}

<h2>Summary</h2>
{attribute_view_gui attribute=$node.object.data_map.short_description}

<h2>Description</h2>
{attribute_view_gui attribute=$node.object.data_map.description}

<h2>Show children</h2>
{attribute_view_gui attribute=$node.object.data_map.show_children}

Finally I add the code (as indicated in "Ez publish basics" page 149)

<form method="post" action={'/content/action' |ezurl}>
<input type="submit" name="NewButton" value="Inizia Questionario" />
<input type="hidden" name="ClassID" value="37" />
<input type="hidden" name="NodeID" value="158" />
</form>

Then I clear all cache and reload the page.
But nothing happens.

Someone have any idea where is the error?

christian bencivenni

Monday 12 March 2007 9:01:45 am

I use 3.9rc1 with the ezwebin extension.

Claudia Kosny

Monday 12 March 2007 9:18:40 am

Hi Christian

Have a look at the priority of this override. By default they are added with the lowest priority, so if there is another override (e.g for all folders, no matter the node id) with a higher priority then this will be taken.

Claudia

christian bencivenni

Monday 12 March 2007 9:19:37 am

where is the priority?

christian bencivenni

Monday 12 March 2007 9:23:05 am

i reduce the priority to 1 but nothing change.
there is any ini file everywhere to config?

Claudia Kosny

Monday 12 March 2007 9:42:10 am

Hmm, priority 1 should be work - this is a bit strange. Are your sure that this is afolder you are trying to override? Having the node id as override match condition is sufficient anyway as you cannot have more than one object under a node.

You can have a look at the override.ini of your public siteaccess - each override has it's own block there.

Also check the list of used templates at the bottom of the debug information. This tells you which template was requested initially (most likely node/view/full.tpl) and which template was taken after going though all override conditions.

If necessary post the block of the override.ini for your override here.

Claudia

christian bencivenni

Tuesday 13 March 2007 2:30:10 am

Well...
I'm sure it is a Folder object.
It sounds strange but in the template debug I cannot read full_folder.tpl
Instead it seems it load the pagelayout.tpl template.

I also try to overrede with the Default template option and when i open the .tpl I found this:

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--
{literal}
function checkAll()
{
{/literal}
    if ( document.fullview.selectall.value == "{'Select all'|i18n('design/standard/node/view')}" )
{literal}
...
...

and many more. I cut a lot.
What is this? And where I had to put my button lines code?

christian bencivenni

Tuesday 13 March 2007 2:37:08 am

... and, of course, thank you for your help! :-)

christian bencivenni

Tuesday 13 March 2007 3:33:45 am

Ok.
I made some tests.
Now I know that during the override template wizard if I choose the "Default template" option checkbox I obtain a copy of the full.tpl template. But this is not usefull in my case because I need a new View of the folder in that eact node.
So I need to check the "View (without child)" option.
What I don't understand yet is why nothing change in the front end.
I reply these exact passages with a new class object following the link in the Front End view whch specify that the object hadn't a personal template. In this way it works.
So I deduct that there must be some "sovrapposition" of overrides that negate my own personalized template.

What is the correct template.ini file to watch?
And what I must find in it?

Claudia Kosny

Tuesday 13 March 2007 5:19:56 am

Hi Christian

At the moment I don't have time for a more detailed answer, so in short (more or less):
The override informarion is stored in the override.ini for each siteaccess, there is no template.ini or so involved. In this override ini you should find a block for the override you created. Structure:

[blabla]
Source=node/view/full.tpl
MatchFile=my_new_template.tpl
Subdir=templates
Match[node]=123

This assumes that your override file my_new_template.tpl is located directly in the override/template folder of the design folder of your siteaccess.

123 is the node id of the node whose template should be overridden by this one.
blabl is the name os the section, this is most likely the filename of your override template.

Download the override.ini, make sure that this block is before all other blocks, upload the file again and empty all caches.

Which view you selected during creation of the override is not important for this, the view just determines the content of the override template (which you want to change anyway), not the override conditions.

Claudia

christian bencivenni

Tuesday 13 March 2007 9:08:40 am

sorry for the disturb.

I find it:

[vista_questionario]
Source=node/view/full.tpl
MatchFile=vista_questionario.tpl
Subdir=templates
Match[node]=143

the problem is that nothing happens. Even if I put it on the top of the document
I also try cancelling all the template content exept for the <h1>name</h1>

I really don't understand.

christian bencivenni

Tuesday 13 March 2007 10:58:55 am

Well...
I tried in this way:
1. I created a copy of the Folder class.
2. I created an object in the root folder
3. I opened the browser in the front end and follow the link to create a new personalized template
4. I copied and pasted the template of the previous experiments...

and it WORKS!

Why?

The problem is that now I have to personalize an edit template of an object. And I don't have the same way to resolve.

NOTE: I use a multilanguage site with 3 languages. Do you think that the problem could dempend on this?

Thanks in advance.

Christian

christian bencivenni

Tuesday 13 March 2007 11:23:03 am

A NEW IDEA:
I use ez3.9rc1 with ezwebin extension activated.
I see that some of the template are overrided from the extension.

It is possible that the problems are made from it?
Someone can respond to this question?

christian bencivenni

Wednesday 14 March 2007 12:36:52 am

Ok.
I can confirm the problem.
When I edit a template I see a ezwebin extension template.
How I can override them?

Claudia Kosny

Wednesday 14 March 2007 3:04:17 pm

Hi Christian

Sorry for the long delay. Unfortunately it looks like I can't help you at all.
I have tried creating a node template override using the admin interface in eZ 3.9.0 (svn 17706). At the beginning it did not work although I gave it priority 1 in the admin interface. Then I edited the override.ini manually and put the override block at the beginning of the file. After clearing the cache the new template was used.
The new template is automatically put in design/ezwebin/override/templates/my_new_template_name.tpl.

As everything is working fine for me I can't suggest you any solution for your problem. The fact that it is working fine when you create a new class indicates that there is an override for folders with a higher priority which on the other hand should not be there if you have changed the override.ini manually. AFAIK The fact that you use ezwebin extension should not matter for this. The extension can cause problems if the templates have the same filename, which is not the case for you (unless it is a new bug...)

Good luck

Claudia

christian bencivenni

Wednesday 14 March 2007 11:35:56 pm

Hi Claudia.
Thank you for all your tame spent. All your tips are great and usefull.
For now I think the problem can be resolved copying the ezwebin extension in a new_ezwebin extension, activating it from the admin interface and starting modifing the new one overriding the old one (accordingly with the instructions find here: http://ezpedia.org/wiki/ez/overriding_the_default_website_interface_extension)
Today I will made some tests.
I hope all will work fiine.
Thanks a lot for your precious help.

Christian