We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7349
    • 40 Posts
    Hello Everybody,
    I just started with modx. With "static" websites I changed the picture in a header of a page with a class that I put in the header id, like this;
    <div id="header" class="home">

    and in the css i arranged what the "home" picture was.
    So i could give each page a new header picture if i wanted it.
    Now i want to do that in modx, but how can i change that class for each page???
    Maybe with some kind of chunk or snipped or plug-in, i don’t know, can anybody push me in the right direction?
    Thanks in advance,
    Diederick
      • 28439
      • 222 Posts
      Hi Diederick,

      you can do this with template variables (tv).

      If you want one class for every page do this for every page, use a text variable, but don’t forget a default value.

      Connect the tv to your templates and the variable is available in every document. In the templates you have to insert the tv at the place, where you want to define the class. Thats all, no snippet needed at all.

      Regards

      Stefanie
        Gone away and found a better place to stay
        • 7349
        • 40 Posts
        Hi Stefanie,
        Eh... template variables.. ok, I’ll have a look.
        Sounds good, thanks for the push.
        Diederick
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Some examples of use of TVs here http://sottwell.com/how-template-variables-work.html
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 7349
            • 40 Posts
            Stefanie, thanks a lot, I have got it working, great!
            Just what I wanted.
            And yesterday, thanks for the link, put it in my favorites.
            Only the second picture (Editing a Template Veriable) isn’t working, but thanks anyway.
            Diederick
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Fixed; thanks cool
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 27347
                • 65 Posts
                Quote from: diederick at Jul 29, 2010, 09:02 AM

                .......
                And yesterday, thanks for the link, put it in my favorites.
                .......
                Diederick

                Look yesterday’s username is today today wink
                  • 7349
                  • 40 Posts
                  Sorry, yesterday, today, eh Susan embarrassed
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    That’s OK, just don’t call me Suzie Surprise! (Israeli inside joke)
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 32674
                      • 101 Posts
                      Quote from: sottwell at Jul 31, 2010, 10:13 AM

                      That’s OK, just don’t call me Suzie Surprise! (Israeli inside joke)

                      http://www.youtube.com/watch?v=B1VTaeESbY4