Modulated Templated CMS system |
[eluser]Avatar[/eluser]
Here I will explain how to build a smarty templated modulated CMS. please follow the instructions on this thread to setup your smarty templates system http://ellislab.com/forums/viewthread/60050/ also please see this thread for modules setup instructions: http://ellislab.com/forums/viewthread/73177 configure your routes.php file like this: Code: $route['default_controller'] = "default_controller"; now create a controller called default_controller like so in your app/controllers directory: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Code: <?=$template?>
[eluser]Avatar[/eluser]
now for the fun part. copy over the modular_extentsions.php to your app/libs and modular_helper.php to app/helpers, make sure that your smarty templates folder is located inside app/views and inside the smarty folder create a folder default_template and templates inside the templates directory all your site templates will go, your structure should looks like this. Code: app/
[eluser]Avatar[/eluser]
now for the modules: in your app/ directory make sute to have a directory named modules, this is where all your modules will go. Structure like this: Code: app/ $this->environ->template holds the path to the active template which is easy enough to figure out so I won't go into details ex. smarty/templates/$template Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
[eluser]Avatar[/eluser]
this way you can load modules within modules and have them either display there module/view or a template from the templates folder ditermined by the template environ variable. Enjoy. I've been waiting for something like this for a while myself. Any comments at all would be greatly appreciated.
[eluser]Avatar[/eluser]
tpl_index.php will be located in app/views/smarty/templates/$template like so: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
[eluser]Varzock[/eluser]
On a quick glanze, this is what I have been planning to do myself but I bet not on this scale. I don't have time to test it now but it sure looks promising. Thanks for your effort
[eluser]Avatar[/eluser]
no problem, let me know what you think once you test it
[eluser]a&w[/eluser]
[quote author="yingyes" date="1204762557"]now for the modules: in your app/ directory make sute to have a directory named modules, this is where all your modules will go. Structure like this: Code: app/ [/quote] Is this directory correct? (app/modules/home/controllers/) Or did you mean app/home/modules/controllers/ I'm trying to get the basic understanding of using HMVC from your tutorial here, although I haven't used smarty, so I'm trying to get the point without smarty involved. I also tried looking at the InkType blog setup, but that server is down so I didn't get far with that one. I think another good reference example may have been to use bambooinvoice.org. A common 'hello world' example would be beneficial for all user extensions.
[eluser]Avatar[/eluser]
@a&w;- yes your modules will be located inside the app/modules/ directory like this: Code: app/ Code: function _remap() and a render method inside default_controller.php Code: function render($content) makes it so that if a module doesn't exist it will redirect to default module and will not show this line from modules_helper.php Code: show_error("Unable to locate the requested file: ".$path2file); Code: function exists($file, $path = '', $base = 'controllers/') |
Welcome Guest, Not a member yet? Register Sign In |