Quick link building library - 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: Quick link building library (/showthread.php?tid=5341) |
Quick link building library - El Forum - 01-18-2008 [eluser]awpti[/eluser] Code: <?php Tabbing is a tad goofed, but it works quite well. Very simple: Code: $this->awpnav->css_class = 'current'; This added about 0.003 seconds to the page render time - don't know if that's horrible, but it seems to run well under a load. Hope someone finds this useful in some way! This is my first-ever foray into developing my own library. Comments are appreciated even if you don't have a use for it. I'd love to know what I could do better and what, if any, bad practices I may be approaching. You can see it in-action on onlytechnews.com and the source here: http://onlytechnews.com/source/libraries/Otnnav.phps http://onlytechnews.com/source/controllers/otn_front.phps These are symlinks, so any changes I make are reflected instantly. Cheers. Quick link building library - El Forum - 01-18-2008 [eluser]xwero[/eluser] From my point of view i wouldn't do this in a class but as a helper. There are a few reasons for this - i think the menu will not be build in the controller - if you put awpmenu() in the view it can take advantage of the the current uri_string and compare it with the links - i think creating html should be done using a view file for more configuration But i say it again my view on things your method works already. Quick link building library - El Forum - 01-20-2008 [eluser]dawnerd[/eluser] Yea, I agree with xwero. Html should be produced in the view file. It;s really bad habit to put html in a function. |