Inline AND OR with Design Areas


(Lewis) #1

Hi,

Does anyone have an idea how you can create AND OR conditions with the show_if Design Area?

Here’s my code:

<MySource_AREA id_name="is_homepage" design_area="show_if"> 
          <MySource_SET name="condition" value="asset_is_index_asset,asset_is_site_asset" /> 
          <MySource_THEN>This is the homepage</MySource_THEN>
          <MySource_ELSE>This is another page</MySource_ELSE>
        </MySource_AREA>

I’m trying to say if the asset is the index or site asset, say “This is the homepage”. If it isn’t then say “This is another page”.

I’ve seen in the manual that there are options for other show_if areas to use a comma to indicate AND/OR conditions but it doesn’t seem to work with the code I have. Am I missing something? I thought about using %begin_ … etc but it wouldn’t meet DRY principles.


(Harinder Singh) #2

You can use the keyword:

%frontend_asset_is_homepage^eq:1:This is the homepage:This is another page%


(Lewis) #3

Hi @harinder.singh. Thanks for the reply. I ended up with %begin_asset_is_homepage% which worked.