Quote from: OpenGeek at Jul 28, 2009, 03:01 PM
since it was built to avoid these combinations of logic and presentation. TBH, you might as well use plain PHP, or JSP, or ASP if you want to circumvent this important MVC goal.
Fwiw, I agree that PHx can certainly be abused. I see many new MODx users go down the "make everything one template and use dozens of TVs to control the output", just like the "use one template and have tons of PHx in there to presentation." But imo the main reason PHx _can be_ so great is because you don’t have to worry about nesting snippets within snippets, as the whole snippet nesting business can only go 2 levels. (Right? Or have things when I wasn’t looking?)
That said, I do agree with Charlie about if/else statements being _extremely_ useful. I’m not going to argue against MVC principles, but imo it’s just so much easier and more maintainable to use PHx for a quick bit of logic (as it relates to presentation) than it would be to write a snippet, create two or three chunks (that potentially have additional snippets inside them), and then put it all in the template. I mean, I get that splitting it all up is more proper, but the reality is that if I’m going to need to change the logic _or_ the presentation down the road, odds are I’m going to be rebuilding both at the same time anyway. And, as mentioned, nesting snippets gets squirrely.
I’ve seen a lot of discussion about this idea with CSS lately as well. Yeah, using a grid system and giving classes like .grid_6 isn’t proper, but the reality (imo) is that if you find yourself in the situation where you’re needing to substantially change the layout, you’re likely going to be rebuilding (at least some of) the HTML anyway. CSS Zen Garden is great, but in the day to day business of building websites and systems...
Anyway, just my opinion. I’m only chiming in because I’m interested in where people stand and how people address basic template logic without PHx.