We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37042
    • 384 Posts
    I have a site which I need to turn into 2 contexts and I was wondering if In/Output Modifiers worked with contexts and how would I reference a Context.

    IE

    If Context = Context A, use Logo A else is Context - Context B use Logo B

    If Context = Context A, redirect Formit Confirmation to Confirmation Page A. Else If Context = Context A, redirect Formit Confirmation to Confirmation Page B

    That kind of thing.
      ...
      • 3109 ☆ A M B ☆
      • 894 Posts
      For something like this I use Context Settings.

      Make a context setting for each site so for example I make a Logo context setting which contains the path to the logo then you use the context setting in your templates to display the logo like this:

      <img src="[[++logo]]"/>
      


      You can do the same for your formit confirmation page, emails and pretty much any settings or parameters you want, Context Settings are like global template variables for the context just make sure you clear your cache every time you edit them.

      Context Settings are extremely useful especially to reuse code I go into more detail on how to use Context Settings in my tutorial here.

      Good luck.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 37042
        • 384 Posts
        That's really really cool. Thanks benmarte. Already up and running smiley
          ...
          • 3109 ☆ A M B ☆
          • 894 Posts
          Glad to help wink
            Benjamin Marte
            Interactive Media Developer
            Follow Me on Twitter | Visit my site | Learn MODX
            • 37042
            • 384 Posts
            This is probably a bit more work than your idea but I discovered I can set a unique system setting for each context and call a chunk based on that.

            [[++Context-ID:is=`WebsiteA`:then=`[[$Get-Website-A-Chunk`]]

            Still, nice to have both options. I can think of several areas where I could have used this in the past and hadn't.
              ...