Welcome Guest, Not a member yet? Register   Sign In
is there a way to make Codeigniter use a template for the pages ?
#5

[eluser]ramm[/eluser]
I'm using Smarty3 with CI

http://ilikekillnerds.com/2010/11/using-...i-library/

With the blocks from Smarty, i do something like this:

Master Template
Code:
<!DOCTYPE html>
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;{$title}&lt;/title&gt;
    &lt;link rel="stylesheet" href="css/style.css" type="text/css" /&gt;
&lt;/head&gt;
&lt;body&gt;
    <div id="wrap">
        <div id="head">
            <h1>Title</h1>
        </div>

        <div id="main">
            {block name=content}{/block}
        </div>

        <div id="foot">
            <p>Terms, Copyright, etc</p>
        </div>

    </div>
&lt;/body&gt;
&lt;/html&gt;

Views
Code:
{extends file="includes/master.php"}

        {block name=content}
        <div id="cont">
                    <p>Data here</p>            
        </div>
        {/block}

Which is basicly what you are asking for. It can as deep as you want and also you get in the viw all the Smarty functionality like conditionals, loops, cycles, variables with defaul values, etc.


Messages In This Thread
is there a way to make Codeigniter use a template for the pages ? - by El Forum - 03-01-2011, 05:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB