CodeIgniter Forums

Full Version: Template system in CI 2.0.3 question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hello

I'v just started with Codeigniter and I have some problems figuring out how to develop a good template system.
Usually I would create a switch in my index file and include the page the user is requesting.

Example
Code:
<div id="content">
&lt;?php
        switch($page) {
            case 'addpage':
                require('pages/addPage.php');
                break;
            case 'addnews':
                require('pages/addNews.php');
                break;
            case 'addblog':
                require('pages/addblog.php');
                break;
            default:
                require('pages/start.php');
                break;
        }
?&gt;
</div>

Perhaps this isn't a "pro" way of doing it but it works Big Grin

My question, is there a way of doing this with functions within CI or do I need to find a template library compatible with CI v2.0.3? I have found some libraries but they don't seem to work with 2.0.3.