Published on: 12 Sep 2016
In this new series of short articles called #whyusemodx I will showcase why we at Any Screen Size choose MODX for almost all of our web projects.
Wordpress forces you to use PHP and something they call a loop to get a list of articles:
So this looks pretty advanced to someone who does not know a lot of PHP!
So how would we get a list of posts using MODX?
I love this simple code! This simply tells MODX to display a list of resources.
The only option we really need is &tpl this is used to assign the HTML code to be used to list each post item. A very basic example would be to create a chunk called articleItemTpl:
I don't know about you, but I prefer clean and neat code that is structured and sperated by type: HTML should be only HTML, PHP only PHP. With Wordpress you end up with many HTML files that contain huge blocks of PHP code, it is one of the most confusing parts of using Wordpress and using the loop can be a huge pain.
So how do you want your template code to look?
Feel free to contact us to find out if we can help you improve your website.