We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33453
    • 141 Posts
    I have made a simple mod to the NewsListing snippet to give both the displayed articles and the archive links a separate ID so that I can apply styling to them (in my case I want them displayed side by side rather than one above the other).

    Maybe someone else will find it useful.

    Anyway, I changed 3 lines in the snippet:

    $output .= str_replace($fields,$values,$tpl);
    $output .= "<div id=’mainitems’>" . str_replace($fields,$values,$tpl) . "</div>";

    $output .= "<h3 class=\"nlArchtext\">$archtxt</h3>";
    $output .= "<div id=’otheritems’><h3>$archtxt</h3>";


    $output .= "</ul>";
    $output .= "</ul></div>";
    • Sounds like that’d be a good thing to add to the next iteration/release of the main Newslisting snippet, similar to the dropmenu wrapping div option. Thanks for contributing that!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 32963
        • 1,732 Posts

        I don’t thing that’s a good thing to do since there might be other elements of the page might be using something similar.

        The NewsListing snippet allows you to use a templat so I guess you could a modified templat with the approriate ids or class name.
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
        • The archive listing is displayed outside of the template.

          However, it is a good idea to always have the default class and id names use the snippet name in some way to make it distinct, like nlMainItems and nlOtherItems.
            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