Hi
I’m messing about with something and I want to ask your opinion.
I’m trying to make a generic block of content a bit more flexible, ie: allowing a user to choose whether it’s a full content item, or just a section heading.
So here’s what I’ve done:
** note: the user uses "Section" in the long title field if they want it to be just a section heading; As for :clean, that takes any accidental spaces, punctuation, etc. out and makes it all lowercase **
[+longtitle:clean:isnot=`section`:then=`
<a href="[~[+id+]~]" title="[+longtitle+]">[+title+]</a>
[+longtitle:isnotempty:then=`<h2>[+longtitle+]</h3>`+]
[+introtext:isnotempty:then=`<p>[+introtext+]</p><a href="[~[+id+]~]" title="[+description+]" class="read-more"><small>Read More...</small></a>`:else=`<p>[+content+]</p>`+]:else=`<h1 class="section">[+title+]</h1>`+]
...and that is working quite well so far. But it seems a bit convoluted to me, and I can’t help but feel like it’s going to come crashing down if the [+content+] gets any more complex than just a bit of text and an image or two.
Since I’m relatively new to Modx I was hoping for a bit of feedback from more experienced users as to whether this bit of silliness might hold up OK?
Thanks very much for any advice you can give.
-Gabriel