New Design vs Longer Design with multiple show_if areas


(Douglas (@finnatic at @waikato)) #1

We have a collection of sites all using the same base design (with customisations as appropriate).  I'm working on one site where I need to display additional data in the menu section of the design, and this has led me to consider the following two options:

 

A - Creating a new design with the additional data added in the parse file, but otherwise basically a copy of the standard design.

B - Creating a show_if area in the existing design parse file, matching against the urls (using request_uri) for the pages that need to display the data and displaying it if matched.

 

I'm not sure which is more optimal for server performance.  Both have maintenance issues e.g. A) may need multiple designs to be edited for major changes, B ) is going to result in a longer parse file.

 

Any thoughts from anyone whose implemented something like this before?


(Nic Hubbard) #2

Why not just set print to no in the parse file for that design area. Then create a Customization and set it to yes? Then you can apply that where ever you want.


(Douglas (@finnatic at @waikato)) #3

Nic, that's essentially what I'm thinking of doing with option B (original post edited to remove emoticon that wasn't intended).

 

My concern with using show_if or customisations to print a print="no" design area for individual sites is whether the non printed design_area get processed by Matrix at the point it's printed or when it's declared.
 
If it's when it's declared, then Matrix will have to process it for all the sites using the common design, which might not be desirable.

(Nic Hubbard) #4

 

Nic, that's essentially what I'm thinking of doing with option B (original post edited to remove emoticon that wasn't intended).

 

My concern with using show_if or customisations to print a print="no" design area for individual sites is whether the non printed design_area get processed by Matrix at the point it's printed or when it's declared.
 
If it's when it's declared, then Matrix will have to process it for all the sites using the common design, which might not be desirable.

 

 

Quite sure that it only gets processed when you submit the parse file. At that point a PHP template is created. But, lets see what someone from Squiz says...


(Douglas (@finnatic at @waikato)) #5

Your reference to the PHP template creation got me diving into the file system - it looks like for what I'm doing

 

 <!--@@ Begin Menu Title @@-->

   <!--@@ This prints the current site section lineage in the LHS @@-->
   <MySource_AREA id_name="current_section" design_area="asset_lineage" print="no">
...
   </MySource_Area>
   <MySource_AREA id_name="sectionHeading" design_area="show_if">
   <MySource_SET name="condition" value="server_variable"/>
   <MySource_SET name="condition_server_variable" value="REQUEST_URI" />
   <MySource_SET name="condition_server_variable_match" value="^/subsiteURL(.*)" />
   <MySource_THEN>
   <MySource_PRINT id_name="current_section"/>
   </MySource_THEN>
   </MySource_AREA> 
 
then the resulting PHP does the conditional check before trying to compile the design area - but it would be good to get Squiz confirmation of that.