![]() |
back-end front end best practices - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: back-end front end best practices (/showthread.php?tid=38218) |
back-end front end best practices - El Forum - 02-02-2011 [eluser]ssachan[/eluser] Hello Developers, I have developed a few apps using jquery and CI. However I wanted to know more on how we could better organize our code. For eg. my view file generally looks something like this - <HTML> ... ... <BODY> <?php ... some dynamic stuff ?> </BODY> </HTML> [removed] var someVar = <?=dynamically passed id ?>; var someVar2 = <?=dynamically passed id ?>; .... [removed] It really gets messy. I have seen some coder echoing everything , something like echo "<HTML>"; But I believe that we should dynamically insert the elements since it has the following advantages. 1. You can actually design the page leaving gaps where data can be dynamically inserted.(using a WYSWUG) 2. Editing becomes a lot more easier But with something like this, it becomes difficult to push in code in the include files. For eg. if I have a common.js(which is a script included in a lot of common pages) cannot have dynamic values. hence there is a divide. Also, I really don't find it useful to wrap around HTML form element with CI code, just adds another layer overhear definitely worth a discussion. I would like to hear how coders have been successfully managing code. thanks Shikhar |