eZ Community » Forums » Setup & design » Multiple design extensions
expandshrink

Multiple design extensions

Multiple design extensions

Thursday 13 September 2012 2:53:44 pm - 1 reply

Hello,

I've got most of my site's logic and design in an extension called ext1 (which is also a design extension).

This extension defines a page_layout.tpl file, which includes a page_mainarea.tpl file (which just outputs the result content of the current module)

I now want to implement some new functionnalities in a separate extension, ext2, which will contain a module for handling users' personnal details.

I want my user module to have the same look and feel as the main part of the website. One of the main differences is that there will be an extra menu on all the pages located in the user profile module.

 

So I just declared ext2 as a design extension, and created a new page_mainarea.tpl in ext2's design folderwhich, which outputs the result of the module AND an extra menu.

 

Problem: it looks like the page_mainarea.tpl of ext2 is never used, instead it always uses the one from ext1.

After some tests, it appears that it is due to the order in which the extensions are declared in the site.ini. ext2 is declared after ext1, so ext1's design seems to take precedence over ext2.

 

However I cannot simply switch that order: if I declare ext2 before ext1, then I correctly see the menu on the user profile pages, but also on ALL of the website's pages.

 

I also found one workaround so far:

  1.  in ext 2, create a mypagelayout.tpl file, which is an exact copy of the ext1's pagelayout.tpl file, except that it includes 'mypage_main_area.tpl' instead of 'page_main_area.tpl'
  2. create 'mypage_mainarea.tpl', which is an exact copy of ext1's page_mainarea.tpl except that it includes the extra menu I need
  3. Modify all functions if my user module to set the correct layout: $Result['pagelayout'] = 'mypagelayout.tpl';

 

Obviously this is not a really good solution, as I need to duplicate design files. However, I haven't found any better solution.

Can anyone help?

 

Thanks

Modified on Thursday 13 September 2012 2:55:12 pm by H R

Thursday 13 September 2012 4:56:29 pm

You should probably use 2 siteaccesses, and in the 2nd one, configure as main edsign a new design, and use the main design you are currently using as "1st fallback design".

This way, regardless of extension ordering, you always get design elements from 2nd design loaded first.

In fact you do not even need a 2nd extension for this, as extensions and designs are orthogonal. One extension can have templates fro many designs.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from