• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you implement master templates that are used across the site?

#5
[eluser]Karlos23[/eluser]
Well I have a public var in my controller $data and each new controller contains it. It has a title, menu and content part to it what allows me to leave the template and just create other views leaving the master template alone.

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
    &lt;head&gt;
        &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/&gt;
        &lt;meta name="description" content="&lt;?php echo $this-&gt;config->item('meta_desc'); ?&gt;" />
        &lt;meta name="keywords" content="&lt;?php echo $this-&gt;config->item('meta_key_words'); ?&gt;" />
        &lt;meta name="author" content="&lt;?php echo $this-&gt;config->item('game_owner'); ?&gt;" />
        &lt;link rel="shortcut icon" href="&lt;?php echo $this-&gt;config->item('favicon'); ?&gt;" type="image/x-icon" />
        &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url(); ?&gt;assets/css/960.css" media="screen" /&gt;
        &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url(); ?&gt;assets/css/pri.css" media="screen" /&gt;
        &lt;title&gt;&lt;?php echo $title.' | '.$this->config->item('game_name'); ?&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        <div class="container_12">
            <div class="grid_12">
                <h3>&lt;?php echo $this->config->item('game_name'); ?&gt;</h3>
            </div>
            <div class="grid_2">
                &lt;?php $this->load->view('menus/'.$menu); ?&gt;
            </div>
            <div class="grid_10">
                &lt;?php $this->load->view($content); ?&gt;
            </div>
            <div class="grid_12">
                <div class="left">
                    <p class="italic small">&lt;?php echo $this->config->item('game_name'); ?&gt; &copy; All Rights Reserved Worldwide &lt;?php echo date('Y', time()); ?&gt;</p>
                </div>
                <div class="right">
                    <p><img src="&lt;?php echo base_url(); ?&gt;assets/imgs/time.png" alt="Time: " title="Time" /> &lt;?php echo date('l, F jS, g:ia e', time()); ?&gt;</p>
                </div>
            </div>
        </div>
    &lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
How do you implement master templates that are used across the site? - by El Forum - 04-24-2010, 02:44 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.