Forums / Setup & design / Idea for template engine improvement

Idea for template engine improvement

Author Message

Michal Slocinski

Monday 15 August 2011 3:00:38 am

Hi all!

I have following idea for improvement in the area of template / override management (perhaps it is already available as standard functionality or some extension which I'm not aware of).

My current workflow when creating new templates & classes is following:

  1. create class
  2. edit override.ini.append.php to add mapping to views of this class (full, line, etc.)
  3. create files

Step 2 is cumbersome and I think it can be simplified with "convention over configuration" approach known from modern web frameworks such as RoR.

Instead of requiring user to edit "overrides" file, let system search for template with id of class in folder with name of view in your current design folder ("override/templates/VIEW/CLASS_ID.tpl").

So for example, assuming I just created class "book" I would go to my design folder and inside "override/templates/full" and "override/templates/line" I could create files "book.tpl" which are default for my class.

Does this make sense? Or perhaps there is already better method available? 

Michal

Gaetano Giunta

Monday 15 August 2011 8:21:42 am

A little while ago I proposed something similar on the eZ internal developer's mailing list: allow to specify node_id, class_id, section_id or any combination thereof in override conditions, by simply baking them in filename of the template.

This idea was not well received, as some developers thought that the extra flexibility given by the current system is too much important to be lost.

But maybe we can find common ground: look up templates using a convention-filename first, and if not found using the override.ini rules (or in the opposite order). And throw in an ini setting to disable override.ini at all.

Maybe you can submit this to the roadmap tool?

btw: a similar feature request (existing in the tracker iirc): avoid usage of override.iini for templates used for ezflow blocks...

Principal Consultant International Business
Member of the Community Project Board

Michal Slocinski

Monday 15 August 2011 8:32:57 am

"

This idea was not well received, as some developers thought that the extra flexibility given by the current system is too much important to be lost.

But maybe we can find common ground: look up templates using a convention-filename first, and if not found using the override.ini rules (or in the opposite order). And throw in an ini setting to disable override.ini at all.

"

Yeah that was my idea - don't deprecate existing override.ini mechanism since huge amount of sites depend on it but add this new mechanism as additional mechanism of configuring overrides. First, system would check whether template with name matching convention exists and if not - use standard override.ini mechanism.

Robin Muilwijk

Monday 15 August 2011 11:26:39 am

Hi,

Gaetano referred to the new Roadmap we have on our community platform. You can find it here: http://share.ez.no/roadmap. You can submit your idea there.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Carlos Revillo

Tuesday 16 August 2011 8:00:48 am

"

This idea was not well received, as some developers thought that the extra flexibility given by the current system is too much important to be lost.

But maybe we can find common ground: look up templates using a convention-filename first, and if not found using the override.ini rules (or in the opposite order). And throw in an ini setting to disable override.ini at all.

"

Hi Gaetano!

Maybe i'm missing something but i don't see lost of flexibility here. As you say, if the system look for a 'convention-filename' template and use override in case not found, i think you're "adding" flexibility instead. ihmo, it won't hurt if, for example, you create a class called "book" the system looks for override/templates/node/view/full/book.tpl or override/templates/line/book.tpl when needed as exposed by Michal. 

One note though. i was told to put in "override" folders all templates referenced by override.ini files... so, it we won't add that ini settings... where should we add those new templates? maybe in [design]/templates/node/view/whatever.tpl instead?

Cheers.

Michal Slocinski

Tuesday 16 August 2011 9:17:11 am

"

Hi,

Gaetano referred to the new Roadmap we have on our community platform. You can find it here: http://share.ez.no/roadmap. You can submit your idea there.

Regards Robin

"

I added it to the roadmap yesterday but I don't see it published yet. Does it need to go through some approval process?

Michal

Robin Muilwijk

Tuesday 16 August 2011 11:12:46 am

Hi Michal,

I'll have to check on the approval, if that is part of the "process", back with an answer asap. Thanks for adding it there.

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Robin Muilwijk

Tuesday 16 August 2011 11:16:01 am

Confirmed :) See http://share.ez.no/community-project/ez-roadmap-description-faq#4

Approval is indeed part of submitting something on the roadmap.

 

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Gaetano Giunta

Friday 19 August 2011 4:00:43 am

@Carlos I think the separation of templates in the templates and override directories does not add any value to eZP and that it should be eliminated at some point in the future...

Principal Consultant International Business
Member of the Community Project Board

Carlos Revillo

Friday 19 August 2011 4:12:45 am

@Gaetano. Cool. Yeah. +1 for that.