Textpattern CMS support forum
Which is method is better?
I just was working on a site which I didn’t originally build which used one huge form for all articles for all sections/categories with lots and lots of conditionals.
I normally try to keep things pretty simple with smaller focused forms, but end up with lots of forms?
Are there any benefits/downfalls to either method?
Re: Which is method is better?
You can pretty much do which ever you prefer. If splitting the code in to smaller junks makes it easier to read to you, then that’s a better method for you. I personally like anything “modular”, and like to split and group parts of the page into smaller junks.
Sure, technically there can be downfalls when it comes to performance with both. If templates are huge, with lot of conditions and tags, parsing the tags on a single page template will take longer than a slimmer page. But if you are calling 100 forms per a page template, then you have extra 100 SQL queries eating resources instead. It comes down to balance.
If there is a one tip I can say, when it comes to a form used for loops (e.g. displaying article, an article form), try to avoid adding too much extra code to those. Any code in those is executed multiple times on a page. Otherwise the same code, the same unnecessary section check is done on each time an article is displayed. While a section condition itself doesn’t take much from the server, the things can add up.
Last edited by Gocom (2012-08-03 01:19:53)
Rah-plugins | What? I’m a little confused… again :-)