hello all, I am currently trying to optimize an existing website as the loading time of some pages is not ideal. I stumbled upon something I want to double check with someone who is more experienced on these matters.
I usually code my pages with a lot of flexibility to simplify what content uploaders have to do and avoid common problems. One common scenario is with a TV which holds an image that represents a given document.
Consider this:
[[*ft_img:notempty=`<div class="ft-img"><img src="[[*ft_img:phpthumbof=`&w=300&h=175&zc=1`]]" alt="[[*longtitle]]" width="300" height="175"></div>`]]
I do this quite a lot through my templates in different situations and with different content types and template variables.
If I understand how modx works correctly then the order in which the above gets executed is that phpthumbof will process its image, then move up to the conditional. Regardless of the conditional, the phpthumb code gets executed which is not ideal performance wise. Am I correct assuming this?
If so there is a whole lot I can optimize by recoding some things which depend on other conditionals but are getting executed regardless.
Another common scenario for me are context settings. I usually make custom context settings and work my website structure based on the values of these settings. This allows me to use a single template for multiple languages effectively, but again at the cost of performance when using this approach.
I'm wondering what the right way of achieving this would be, how are people working around this subject when coding their templates?
Thanks.