Conditional Keywords and the Parse File

Hi everyone,


I want to use conditional keywords to generate some content, then ouput that content at a later point:



I have been using metadata to define which 'call to action' links ought to display on each page. (This is to enable page editors to enable or disable links such as 'Contact Us' or 'Apply Now' and so on for each page.) I think the use of this will be fairly arbitrary so I can't assume all the pages in a given section of the hierarchy will share a common set of links, so that's why I chose metadata to represent this.



To achive the correct output I have used conditional keywords in the paint layout that I apply to these pages along with the metadata schema. Currently the paint layout sets the asset contents in one DIV and then does the conditional stuff in a subsequent DIV. The conditions perform a regex on the metadata to see if any of the known call-to-action metadata fields are set. My CSS handles the layout, but the HTML flow is important.



So, in my parse file I have the body area, which is currently appended with the conditional stuff, followed by a menu design area that's wrapped in a subsequent DIV.



What I want to do is take that conditional stuff and output it after the menu design area. I've been thinking about this as applying a similar paint layout to the menu area (in order to append the conditional content as described) but it seems I can't do this, and the metadata would not be available from that scope anyway!



Does anyone have any suggestions?



Cheers,



Robert

University of Stirling

Hi Robert


Use this to define your content;


    
    
    
    Print your content here
    Print your content here
    

Use this to place your content;


    


There are a bunch of conditions for show if, all of which are described in the design manuals.

Cheers
Shane

For the latest Design manual, refer to the MySource Matrix User Manuals page.

Thanks for your help Shane,


I think what I want to do is use a metadata value as the condition for the show_if design area. Something like:



[codebox]

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

<MySource_SET name="condition" value="asset_metadata_action"/>

<MySource_SET name="condition_status" value="TRUE" />

<MySource_THEN>Call To Action Button</MySource_THEN>

<MySource_ELSE></MySource_ELSE>

</MySource_AREA>[/codebox]

I suppose this is more like matching a value than satifying a status, though. Do you know if this is possible?



Cheers,



Robert

Hey Robert


If you download the design manual chapter 21 on page 111 will give you the variables you can use. I don't think you will find a conventional way to do what you want.



You could, however, use css and your metadata to do it. Create a class for each button that hides the button and use the metadata fied as part of the class name. Then set the class of a container around the button as the default value for the metadata so it is always off, or on if you want. Then a toggle of the metadata will push your buttons;)


    .turn_%asset_metadata_action% {
    
    hide that sucker: you bet;
    
    }
    
    
Push my button, grrrrr


Default for "action" is "off" and if your peeps want it on then all they have to do is toggle the action field to get action.

Unless of course there is a condition for matching values other than server variables that is being kept a secret.

Cheers
Shane

[quote]Thanks for your help Shane,


I think what I want to do is use a metadata value as the condition for the show_if design area. Something like:



[codebox]

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

<MySource_SET name="condition" value="asset_metadata_action"/>

<MySource_SET name="condition_status" value="TRUE" />

<MySource_THEN>Call To Action Button</MySource_THEN>

<MySource_ELSE></MySource_ELSE>

</MySource_AREA>[/codebox]

I suppose this is more like matching a value than satifying a status, though. Do you know if this is possible?



Cheers,



Robert[/quote]

Use paintlayout, I have used metadata as the conditional keyword

Hey Robin


Can you post what/how you did it? I would love to know:)



Shane

[quote]Hey Robin


Can you post what/how you did it? I would love to know:)



Shane[/quote]



We do this all the time using paint layouts and regex on the metadata field.

[quote]Hey Robin


Can you post what/how you did it? I would love to know:)



Shane[/quote]

HI Shane,



Just check the paintlayout manual at http://matrix.squiz.net/download/documentation. Paintlayout renders the design area of body, it’s more flexible than design from my point of view.

  1. it's asset-type based, in design you have to use show_if, quite a lot show_if indeed
  2. as mentioned by Nic, easy to use regex to give conditional keywords on metadata, asset attributes etc
  3. we are using 3.20, the design is not completely based on URL but paintlayout is, so flexible!

    and lots of more fun you'll find!



    Robin