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

    I have a unordered list (ul) and a style applied to each one of the <li> tags, everytime I write <li>...</li> I have a background applied, and inside each list (li) I have an image (img tag).

    I would like to have let’s say... 20 lists to be filled by the clietn on Modx manager. I could do this with 20 TV’s, however, I need to have a widget (?) that applies the <li> tag to each one of my TV. At the moment I made some experiments and the only result was this:

    <li id="tvbimage1">...</li>

    I made this with a TV called bimage1 and a HTML Generic Tag (li) widget in that TV. The background is applied, however, how can I remove the id. The result I would like to have is:

    <li><img src="assets/images/gal/home/[*bimage*]" /></li>


    Thank you in advance.

    Kind regards.
      • 25679
      • 37 Posts
      Rubendoliveira Reply #2, 17 years ago
      No ideas?
        • 15082
        • 195 Posts
        If you have PHx installed (http://modxcms.com/extras/package/342)

        You can create a snippet called [tt]phx:outer[/tt] with this code:
        <?php
        $options = explode("|", $options);
        $outer = '';
        if (trim($output) != '') $outer = $options[0].$output.$options[1];
        return $outer;
        ?>

        Taken from here http://wiki.modxcms.com/index.php/PHx/CustomModifiers#phx:outer

        Then set your TV to use no widget and call the TV in your template like this:
        [*yourTV:outer=`<li>|</li>`*]


        Greetz
        JUSI
          • 25679
          • 37 Posts
          Rubendoliveira Reply #4, 17 years ago
          Brilliant!

          Thank you so much!
            • 15082
            • 195 Posts
            You’re welcome!
            Glad it works for you.

            Greetz
            JUSI