Forums / Developer / New template

New template

Author Message

David Santiso

Thursday 30 December 2010 5:02:16 am

Hi,

I copied a default class to modify my way while preserving the original, but this newclass uses a default template.

How do I create a new template for my class? In which directory do I have to create and what name? What I have to modify configuration files?
Thanks,
David

Edi Modrić

Friday 31 December 2010 9:25:07 am

Hi David,

you need to put your template in mydesign/override/templates/full/ folder. Best practice is that you tpl file name matches your class identifier. So if your new class identifier is my_class, the full path to the new tpl file should be mydesign/override/templates/full/my_class.tpl

After that, you need to add the following in settings/my_siteaccess/override.ini.append.php and clear ini & override caches. (full details at: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Configuration-files/override.ini)

[full_my_class]
Source=node/view/full.tpl
MatchFile=full/my_class.tpl
Subdir=templates
Match[class_identifier]=my_class

eZ Publish certified developer

http://ez.no/certification/verify/350658

David Santiso

Saturday 01 January 2011 11:17:23 am

Thank you.

I copied the template in "extension\ezwebin\design\ezwebin\override\templates\full\copy.tpl". The name of the template is the same as the class.

I added the new lines in the file "settings\siteaccess\[my_syte]\override.ini.append.php", but still shows the default template.

Edi Modrić

Saturday 01 January 2011 2:21:55 pm

Hi David,

this setup should work without problems. You can check couple of things:

1) Did you clear your caches? Maybe purge var/cache and var/ezwebin_site/cache folders directly from the disk?

2) Does your siteaccess use ezwebin as the main or additional design?

3) Are the new settings in override.ini.append.php correct? Doublecheck them.

eZ Publish certified developer

http://ez.no/certification/verify/350658

David Santiso

Sunday 02 January 2011 6:40:06 am

I put this in "override.ini.append.php ":

[full_copy_of_feedback_form]
Source=node/view/full.tpl
MatchFile=copy_of_feedback_form.tpl
Subdir=templates
Match[class_identifier]=copy_of_feedback_form

The name of new class is "copy_of_feedback_form".

How I can clear the cache directly from the disk?

How do I know siteaccess use ezbin as main or additional design?

Thanks,

David

Edi Modrić

Sunday 02 January 2011 7:08:31 am

Hi David,

you have an error in your override rule. Third line "MatchFile=copy_of_feedback_form.tpl" should be "MatchFile=full/copy_of_feedback_form.tpl"

Change that, and clear the caches from administration.

To answer your other questions (but I suppose they are not necessary since override.ini is cause of your problem)

1) You can clear the cache from disk by first positioning yourself in your ez publish install directory and then running the following (take care while running the commands, if not careful, rm can be destructive, do backup your site please!)

rm -rf var/cache

rm -rf var/ezwebin_site/cache

2) You can verify that your siteaccess is using ezwebin design by checking the following in site.ini

[DesignSettings] AdditionalSiteDesignList - ezwebin should be listed in this array

or
[DesignSettings] SiteDesign - ezwebin should be the value of this configuration

eZ Publish certified developer

http://ez.no/certification/verify/350658

David Santiso

Sunday 02 January 2011 9:32:43 am

I do not believe me, but I've changed and still does not work.

I have activated "Template debug". It's looking for the template in "node/view/full.tpl" and "extension/ezbin/design/ezbin/templates/node/view/full.tpl", but my template is in "extension/ezbin/design/ezbin/override/templates/full/copy_of_feedback_form.tpl".

I don't understand :S

My AdditionalSiteDesignList[] array is empty and...

StandarDesign = standard and...

SiteDesign = admin

Carlos Revillo

Monday 03 January 2011 2:35:00 am

hi David.

could you please paste here the entire DesignSettings group in your settings/siteaccess/[mysite]/site.ini.append.php file?

There's one thing i can't understand well. You say you have SiteDesign=admin but you seem to be working with a custom design (mysite), right? It's strange to have SiteDesign=admin in a custom design...

David Santiso

Monday 03 January 2011 11:21:19 am

Ok.

[my_site] as I called my site (the front-end), but should use the default layout, because I have not changed anything.

My DesignSettings group in "settings/siteaccess/[my_site]/site.ini.append.php is:

[DesignSettings]
SiteDesign=ezflow
AdditionalSiteDesignList[]
AdditionalSiteDesignList[]=ezwebin
AdditionalSiteDesignList[]=base
AdditionalSiteDesignList[]=standard

SiteDesign=admin was in "settings/site.ini"

Edi Modrić

Monday 03 January 2011 3:02:54 pm

Hi David,

by mentioning site.ini, I was referring to settings/siteaccess/[my_site]/site.ini.append.php, maybe I should've been more clear, sorry about that :)

Now, I see nothing wrong in your [DesignSettings] configuration in site.ini.append.php
Also, the rule you placed in settings/siteaccess/[my_site]/override.ini.append.php is fine now you corrected it.
The template is placed fine.

I can't think of any reason why it doesn't work, as long as ezwebin extension is activated and caches are cleared, it should :(

eZ Publish certified developer

http://ez.no/certification/verify/350658

Carlos Revillo

Monday 03 January 2011 11:18:50 pm

I second Edi here. You're following the right stepts. Can't find any reason why it is not working...

David Santiso

Thursday 06 January 2011 7:44:43 am

Thanks also for all the help ;)
Try it again, for sure I am overlooking something.

David Santiso

Thursday 06 January 2011 9:23:47 am

I've been looking at other classes in the back-end.

For example, in the editing screen of the class "Feedback form ", is this:

Acceso al sitio Sobreescribir Plantilla fuente Sobreescribir plantilla  
my_site line_feedback_form /node/view/line.tpl    
esl full_feedback_form /node/view/full.tpl    
esl line_feedback_form /node/view/line.tpl    
my_site_admin feedback_form /node/view/admin_preview.tpl design/admin2/override/templates/admin_preview/feedback_form.tpl  

In my class get this:

Acceso al sitio Sobreescribir Plantilla fuente Sobreescribir plantilla  
my_site full_copy_of_feedback_form /node/view/full.tpl    

Edi Modrić

Thursday 06 January 2011 10:55:57 am

Hi David

from this data, it seems that your override rule is being recognized, it is mentioned in the list, under "Sobreescribir", which I presume means "override", however "Sobreescribir plantilla" (override template) is empty, which suggests that either:

1) Your template file name is wrong or somehow at wrong location or can't be read

  • The issue might also be if you created the new file with root priviledges, for example, and eZ Publish simply cannot read it due to lack of permissions

2) Your class identifier, "copy_of_feedback_form" is misspelled

3) "MatchFile=copy_of_feedback_form.tpl" or "Match[class_identifier]=copy_of_feedback_form" lines in your override rules are misspelled.

Good luck in finding the issue!

eZ Publish certified developer

http://ez.no/certification/verify/350658

David Santiso

Thursday 06 January 2011 11:59:57 am

Thanks, I'll keep searching.
But what I find strange is that the class "Feedback form" the "template override" is also empty, except for the administration site.

David Santiso

Thursday 06 January 2011 1:55:15 pm

I don't understand why, but I activated the "eZ Debug - List of used templates".

I pushed the override button of the default template and i added the requested data of the new template and now it works :S

Edi Modrić

Thursday 06 January 2011 3:17:54 pm

"

I don't understand why, but I activated the "eZ Debug - List of used templates".

I pushed the override button of the default template and i added the requested data of the new template and now it works :S

"

Glad to hear you solved it.

This one was a weird one, I'll say!

eZ Publish certified developer

http://ez.no/certification/verify/350658

David Santiso

Thursday 06 January 2011 3:29:45 pm

It seems that the new configuration lines are added in the "extension/ezflow" directory and I added in "extension / ezwebin".

Thanks for your help ;)

David Santiso

Sunday 09 January 2011 9:05:48 am

Do you know how I can make the content that users added in the form displayed on the homepage?

Thanks,

David

Edi Modrić

Monday 10 January 2011 6:25:04 am

Hi David,

you can use standard template fetch functions to fetch collection results and display them on any page.

Take a look at the following fetches:

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/collected_info_collection

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/collected_info_count_list

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/collected_info_count

eZ Publish certified developer

http://ez.no/certification/verify/350658