We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17720
    • 21 Posts
    Hello, Hopefully this the right section for this post. Using a template variable, I need to change the class name depending on the resource parent of the template.

    For instance if menu section (resource parent) is ’X’ then use this class for the template variable [*side feature*]

    I also need to do something similar with tv [*side images*]
    so if the resource parent =x and image has class=Z assigned then make the height 100px and the width200px.

    The widget properties are not flexible(only allowing one value) so I am not sure how to create this code.

    any suggestions?
      • 26016
      • 561 Posts
      Hi,
      Various ways to do that. It depends on how fancy you want to get.

      If you didn’t mind using numbers, you could simply do something like this in your template:

      <div class="doc[*parent*]">
        blah blah blah
      </div>
      


      So if your parent is document 5, you’d get a class value of "doc5". If there’s no parent, it would be "doc0". I added the verbiage "doc" because as I recall CSS objects to classes and ID’s beginning with numbers. A little abstract, maybe, but would be dirt-simple, and no TV needed, it’s automagic.

      Cheers, Dave
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4