XF 2.1 Which is more efficient

ibaker

Well-known member
I wish to completely rearrange how opening posts are displayed on some forums and was wondering which way would be more efficient:

1. Create several new post display templates and edit the main post display template with an IF statement saying if Node ID = array then include template xyz and if not then use the the standard template
OR
2. Create several new styles and force the specific forums to use the different style for the posts in that forum

I would guess the first option would be the most efficient way but thought I would ask

The objective is for example an opening post in one group of forums has Custom Thread Fields that I want displayed on the screen a certain way (page positions etc) plus some other cosmetic changes and another group of forums disp[layed a different way also etc
 
There isn't really a question of efficiency, as such. From a run-time point of view, there's little to no difference in either approach.

Option 2 is fine, and likely easiest from a configuration point of view (because you won't need to write any custom conditionals) but more styles does mean a larger overhead when doing anything which has to rebuild templates or languages (this only happens when you do anything to trigger a change, such as install an add-on or upgrade XF).

FWIW if you went down this route I'd recommend having a primary style at the top level, then have your first post variation styles as children to that parent style. That might make the process slightly simpler when managing upgrades, and it will reduce the number of customised templates overall.

If you're comfortable enough doing conditionals though, then I'd say that would probably be the one to go for. It feels like it would be easier to manage overall.
 
Top Bottom