Conditional logic and declared vars


(Hopkinsd1) #1

Hi,

 

I'm having some trouble setting up some conditional logic within in a design file based on some declared vars.

 

Within my design file I have the following:

I want to be able to check the value of that field and display or hide something on the page based upon it.

 

I thought I would be able to use something like this:

However I realise I cant use that because I cant reference both the declared var id_name and var as the condistion_keyword.

 

Does anyone have a suggestion as to how this can be done?

 

Thanks

David


(Nick Papadatos) #2

Have you tried using metadata? Then set the condition settings: The following keyword matches the specified pattern  to %globals_asset_metadata_<your metadata value>% in your customisation?

Your condition settings would be Yes/No Show/Hide etc

 

example:

<MySource_AREA id_name="masthead_config" design_area="show_if" print="no">

  <MySource_AREA id_name="check_masthead_title" design_area="show_if">   <MySource_SET name="condition" value="keyword_regexp"/>
  <MySource_SET name="condition_keyword" value="asset_metadata_yourassetmetadata"/>
  <MySource_SET name="condition_keyword_match" value="[Ss]how" />
  <MySource_THEN>Display title</MySource_THEN>
  </MySource_AREA>

 

then use

<MySource_PRINT id_name="masthead_config" /> where you want that title to print!

 

You dont need an else - you're either showing the title or its hidden by default

 

Hope this helps

 

http://manuals.matrix.squizsuite.net/designs/chapters/show-if-design-area


(Hopkinsd1) #3

Hi,

 

Thanks for the reply.

 

Unfortunately we are not keen on using metadata in this instance because we have many assets that this design will be applied to and we don't want to have to maintain the metadata for each of those, making a change would be a hassle to update all the assets metadata values.  Where as if we use a design we can make a number of customisations and apply those to the assets, meaning we would only have to update the customisation value to update all the assets.

 

Thanks

David


(Nick Papadatos) #4

So if I understand you correctly you have a page title and a subtitle or tagline that you want to show/hide below a main heading?

If so then maybe this doesn't need to be so over complicated.

  1. Create your  customisation specific for this event and set the print to Yes!

In you Parse File - make sure you have print set to no:

 

 <MySource_PRINT id_name="__global__" var="asset_name" /> {Main heading}

 <MySource_AREA id_name="tagline" design_area="nest_content" print="no" /> nest to a standard page that would contain the subtext (set to raw HTML).

 

So in final apply any page to this customisation that you want the subtext to appear, Yes?