Forums / Setup & design / Clean way of altering ezwebin templates

Clean way of altering ezwebin templates

Author Message

Jon Staines

Thursday 08 February 2007 4:07:09 am

Hi,

I'm trying to find the proper way of altering the pagelayout and other templates now that there is the ezwebin design system. I tried creating an extension which would be called after the ezwebin one, and this worked and called the template from the new extension but it broke the admin interface. I then tried calling this extension in just the eng siteaccess by using

[ExtensionSettings]
ActiveAccessExtension[]=newextensionname

in the site.ini.append.php of the eng siteaccess. But this does nothing.

Any help would be appreciated. I'd prefer to learn the correct way of doing it rather than start altering the templates in the ezwebin folder (unless that is the way to do it).

Regards
Jon

christian bencivenni

Wednesday 14 March 2007 12:19:17 am

I have the same problem.
Did you resolve it?

Paul Wilson

Wednesday 14 March 2007 1:35:07 am

Hi Jon and Christian,

Try this ... it's worked for me.

If you create an extension and put your design templates in an appropriate folder, for example:

/extension/myextensionname/design/standard/templates/

Then enable the extension via the admin interface (or via ini files ... shouldn' t matter).

Then edit your siteaccess override.ini.append.php (eg in eng siteaccess folder for 3.9.0) add add an override items - for example:

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

<b>I suspect that as long as the following conditions are met, everything will work: </b>

1. [Most Important...] the matchfile's name is different from those in the ezwebin extension (ie you're not trying to create a matchfile called pagelayout.tpl)

2. [Perhaps ...] the name of the template override titlie/identifier needs to be different (ie the [my_template_override] shown above.

<b>Why? </b>
EZ Publish seems to search for template matchfiles across any available extensions / designs. Changing the name of your templates means they're not going to be confused with ezwebin ones.

You can see / test this by changing the matchfile name in your override.ini.append.php file to something that just does not exist in your ezpublish. For example:

...
MatchFile=theres_no_way_this_template_exists.tpl
...

If you've got debug / template debug activated, you'll see the results of EZ Publish searching through extensions / designs trying to find the file.

For example:

Error: eZTemplateDesignResource::overrideArray Mar 14 2007 19:17:15 
Custom match file: path 'theres_no_way_this_template_exists.tpl' not found in any resource. Check template settings in settings/override.ini
 
Error: eZTemplateDesignResource::overrideArray, tried files Mar 14 2007 19:17:15 
design/standard/templates/theres_no_way_this_template_exists.tpl, design/standard/override/templates/theres_no_way_this_template_exists.tpl ... (etc)

Hope this helps.

Regards

- Paul

christian bencivenni

Wednesday 14 March 2007 1:45:34 am

Hi Paul.
thanks a lot.
I supposed of a similar solution but you really clear the work.
This afternoon I will try your solution.

Christian

Jon Staines

Wednesday 14 March 2007 2:14:37 am

Thanks for the reply. I'll give this a go later today.

I was hoping for a way to do it without setting up overrides for everything. So that you could just have an extension whose version of full/folder.tpl (for example) gets called instead of the normal full/folder.tpl (not counting separate overrides).

Up until now I've just been altering the ezwebin templates to make it work. While this works fine it isn't very neat as I've got to keep backups of the originals in case they're ever needed by something.

Paul Wilson

Wednesday 14 March 2007 2:40:29 am

Hi Jon,

Hmm ... without a lot of overrides.

I guess you could just keep a backup of the entire ezwebin folder ... use FTP to copy to your local machine, change the name of the folder to (eg) backup_ezwebin and upload it again ... just to keep the files in the same spot. But I expect you've already thought of this.

Another less pretty alternative might be to:
1. do the above, except call the copied ezwebin folder somethink like my_ezwebin
2. change the extension/my_ezwebin/settings files and extension sub-folders to reflect this change in name (ie to my_ezwebin)
3. enable the my_ezwebin extension, and disable the ezwebin extension.

... this might be appropriate if you want to keep your files organised to transfer/use on another site.

- Paul

Jon Staines

Wednesday 14 March 2007 2:46:49 am

Yeah, thought it mind end up being like that. Just keeping a copy of the original somewhere.

Thanks anyway for the help.

christian bencivenni

Wednesday 14 March 2007 7:43:49 am

mmmm...
it seems there is a problem.
I'm not sure but the ezwebin extensions seems more rilevant of the other extensions.
This means that even if I copy-and-rename the directory ezwebin and modify the template inside it they will not be loaded.
How can I set the extensions priority?

Jon Staines

Wednesday 14 March 2007 9:59:19 am

I followed the instructions on this page http://ezpedia.org/wiki/ez/overriding_the_default_website_interface_extension when I was first investigating this and encountered the problems which led me to make this post. However, I've just tried them again to check what I was going to reply to Christian with and it didn't have the problem. I could edit the pagelayout.tpl in ezwebin_custom and it didn't break the admin interface, and would fall back to using the ezwebin extension if it couldn't find a template within my ezwebin_custom one.

I'll let you know if I come across what caused the problem the first time around.