chobo - 18 August 2007 07:19 PM
That modular separation seems like a really good way to organize code, so I’m all for it
I would also like to try templating since I still have design issues with dealing partial or fragment views that depend on a few wrapper div tags that complete the layout, I just don’t know where to put them. I don’t want the in the partials because they make them less resuable, and they don’t work well in default areas. For now I’m going to focus on modular separation, I just have a few questions.
For initial testing purposes, you can take the default welcome application and convert it into a module, then copy the module folder multiple times, assigning a new name each time. Then rename the files for each module and change the code to reflect the name change. This allows you to shell out an entire application quickly. This will give you a basic platform for testing modular separation.
I started out originally with a light template library called bTemplate by Brian Lozier, but after listening to arguments here, I decided to use PHP views. Coolfactor’s view library was a godsend for what I’m doing. It’s also ideal for Web 2.0 layouts. It handles extremely complex master views very well. I use the EXT JS library in conjunction with CI as my basic framework. EXT JS layouts can be very complex. The best way to handle master views or templates is to think in terms of a master view divided into a main container subdivided into subcontainers (left column, right column, navigation, header, footer, etc.). Then you can embed your various view fragments in those subcontainers.
chobo - 18 August 2007 07:19 PM
Q. If I just have two modules say for example my main site code and the admin cms, how would I access my main site with the same url’s as I am now (without specifying the modulename every time). I’m not too clear on how it handles that aspect of it.
I have two applications under the applications/ folder—one called main (the site) and the other called admin. I make a copy of index.php and rename it to admin.php, then include admin.php in my urls to call the admin application. Others have developed some creative ways of handling admin within a single application directory structure. Using my approach, it’s also possible to place an admin directory under a single application (basically, another application within your site application. For larger sites where subdomains are required, I embed a iframe in my Admin template and load the default admin module for the domain and subdomains. This gives me a single entry point for all admin modules among a family of sites.
chobo - 18 August 2007 07:19 PM
Q. What would you suggest as being a good way to handle user authentication. Currently, I just use an .htaccess denying everyones IP, except my own, which was alright. If I use modular separation as far as I know I can’t use that .htaccess solution anymore.
My .htaccess for the site is as follows:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
FreakAuth and UserAuth (extracted from Derek Allard’s miniapp application) can be converted to modules. I’m using a fine-grained RBAC solution that has not been released to the wiki yet (still needs some time to work out the kinks). From other posts, I understand that the Zend Framework’s ACL library works well with CI.