We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36098
    • 46 Posts
    Hi,

    I'm triying to change my header image on my template from one part of the site to the other part.

    Just like on this site : http://www.cspj.be/index.php?module=agenda = one header image and http://www.cspj.be/index.php?module=rentree-scolaire is an other header image in the same template.

    But I'd like to do it under Modx Revolution. WHat's the easyiest way to do it ?

    Thanks for the info,

    Suby [ed. note: subran last edited this post 12 years, 7 months ago.]
      • 22427
      • 793 Posts
      As you can see in the source code of the example pages you linked to, the whole header ist just one single image. You could use a Template Variable for this image.

      A better way is using a background-image. You could have different classes in the CSS defining different background-images, and use a TV named, say, headerclass to provide a choice for the class. So in the page template there you might have
      <div id="header" class="[[*headerclass]]"> ---- content of header here ---- </div>
        • 36098
        • 46 Posts
        Ok thank you but I'm new and have difficulty with TV part

        I added the class to my header and 3 classes =

        header1 {
        background: url(/assets/img/header1.gif) repeat-x right;
        }
        header2 {
        background: url(/assets/img/header2.gif) repeat-x right;
        }
        header3 {
        background: url(/assets/img/header3.gif) repeat-x right;
        }

        And I created the TV named "headerclass" but I don't know how to configure the TV...

        Could you help me ? The tutorials I read aren't pretty clear.

        Thanks,

        Suby
          • 3749
          • 24,544 Posts
          Be sure you spell the name of the TV the same way it's spelled in the tag.

          Try these options for the TV:

          Input Type: Radio Options
          Input Option Values: header1||header2||header3
          Default value: @INHERIT header1
          Output Type: default

          If you have names for the images, you can also do the Input Option Values like this:

          Bird Photo==header1||Lake Photo==header2||Mountain Photo==header3


          Using @INHERIT header1 means that the TV's value will be inherited from the parent, so you only have to set it in the parent document and all the children will get the value. It also makes header1 the default image in case you forget to set one.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 36098
            • 46 Posts
            Ok thanks. Now when I put this line in my template :

            <header class="[[*headerclass]]">


            It shows up as

            <header class="header1">


            But I don't understand how to make it become "header2" and "header3" when I'm on a different part of the site. What should I add and where to have it work ?

            Thanks for the info,

            Suby
              • 3749
              • 24,544 Posts
              You shouldn't have to do anything but edit a resource (or it's ancestor), set the TV, and save the resource. You do that on the TV tab of the Create/Edit Resource panel.

              The header class should change automatically, once the TVs are set.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 36098
                • 46 Posts
                Thank you Bob Ray it works fine !
                  • 3749
                  • 24,544 Posts
                  I'm glad you got it sorted. Thanks for reporting back. smiley
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting