Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-08-03 00:15:22

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 794
Website

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?

Offline

#2 2012-08-03 01:18:48

Gocom
Developer
Registered: 2006-07-14
Posts: 4,394
Website

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 :-) <txp:is_god />

Offline

#3 2012-08-03 07:30:46

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 794
Website

Re: Which is method is better?

Thanks Jukka – that makes sense, I just try keep everything simple, without using too many forms. But some good info there – cheers

Offline

Board footer

Powered by FluxBB