We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20349 ☆ A M B ☆
    • 453 Posts
    Ok, this is more designers question, but maybe there is some native MODx solution...

    I’m doing a new redesign of one of my portals and I was wondering what is the easiest (and for the future respectve changes) way to have different colors for different categories.


    I’m sure you all seen this on many portals... something like:
    Homepage has black background navigation, black links etc.
    Some subpage (other category) has yellow...
    Some other subpage has blue...

    etc... ok you get the point! ermm.. do you? wink
      BASE - Web Design Studio
      MODX Ambassador

      Website
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I use @INHERIT TVs (radio buttons are good for this) and a small <style...> block in the template that uses the TV.
        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
        • 20349 ☆ A M B ☆
        • 453 Posts
        Quote from: sottwell at Feb 10, 2011, 02:41 PM

        I use @INHERIT TVs (radio buttons are good for this) and a small <style...> block in the template that uses the TV.

        Sorry... I’m little tired at the moment and I see chinese when I read... smiley

        Do you mean something like this?
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>my super modx web</title>
        <style>[*customCSS*]</style>
        </head>
          BASE - Web Design Studio
          MODX Ambassador

          Website
          • 20349 ☆ A M B ☆
          • 453 Posts
          EDIT:

          If it helps.. I’m trying to recreate the effect like on this pages..
          http://www.24sata.hr/news
          - RED
          http://www.24sata.hr/sport
          - GREEN
            BASE - Web Design Studio
            MODX Ambassador

            Website
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Not quite.
            <style type="text/css">
            #container{background:#[*customCSS*];}
            </style>
            

            Then I’ll have a radio button TV with the default set to @INHERIT and the option values something like
            Red==ff0000||Black==000||Yellow==fffb80

            Select the color in the parent resource and all the children will inherit it.
              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
              • 20349 ☆ A M B ☆
              • 453 Posts
              But if I want to style more ID’s & classes...

              Example:
              Frontpage (ID=1)
              .header {background:#000};
              .some-div img:hover {border-bottom:3px solid #000}
              


              Subpage (ID=2 .. and all children)
              .header {background:#FFF}
              .some-div img:hover {border-bottom:3px solid #FFF}
              .some-other-class a {color: #060}
              

                BASE - Web Design Studio
                MODX Ambassador

                Website
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                then make a chunk with the css you want, and replace the radio option values with the chunk tags.
                Black=={{black}}||Green=={{green}}||Puce=={{puce}}

                and the style block would then look like you originally suggested.
                  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
                  • 20349 ☆ A M B ☆
                  • 453 Posts
                  Thanks... will try it wink
                    BASE - Web Design Studio
                    MODX Ambassador

                    Website
                    • 19369
                    • 1,098 Posts
                    Another solution, in my opinion easier to maintain, is to add an id to the body. For example:

                    <body id="red-layout"></body>
                    


                    body#red-layout #container {background: red;}
                    body#red-layout #menu {background: red;}
                    body#red-layout #sidebar {background: red;}
                    

                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      That is something I’m always forgetting about! Better, indeed. Still would use a @INHERIT TV to specify the classname of the body element, so no need for multiple templates.
                        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