Where is the best place to put cfqueries?
Where is the best place to put cfqueries, in the <head> </head> or before the html tag? Thanks
Where is the best place to put cfqueries, in the <head> </head> or before the html tag? Thanks
So before the doctype tag? Thanks
So before the doctype tag? Thanks
I just doesn't really matter. the doctype, head, body, etc only matter to the browser; the CF tags only matter to CF. The browser doesn't see the CFML, and CF doesn't care about the mark-up one bit: it just ignores it.
The best place - as I said - is not in the same file at all. But if you insist on slapping your business logic in with your display logic, then the only consideration is that you need to set your variables before you use them. Other than that: it simply doesn't matter.
One consideration you might make is - even if it's all thrown into the same one file - at least separate the file itself into sections: have all your CFML code that gets your data at the top, and try to limit the CFML you have mixed in with the mark-up, eg: limit it to stuff like loops and conditionals.
But, seriously, separate your concerns. Dan's pretty much just wrong when he said it's over-engineering. It's just sloppy to not to write tidy, well-maintained, well-organised code.
--
Adam
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.