-
- 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);
to
$output .= "<div id=’mainitems’>" . str_replace($fields,$values,$tpl) . "</div>";
$output .= "<h3 class=\"nlArchtext\">$archtxt</h3>";
to
$output .= "<div id=’otheritems’><h3>$archtxt</h3>";
and
$output .= "</ul>";
to
$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
-
- 1,732 Posts
Hmmm,
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 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.