Welcome Guest, Not a member yet? Register   Sign In
Repeating, my own function, how?
#2

[eluser]Pascal Kriete[/eluser]
You would could create a library.

Code:
class Layout {

    var $_CI;
    
    /**
     * Constructor
     *
     * @access    public
     */
    function Layout()
    {
        $this->_CI =& get_instance();
    }
    
    // --------------------------------------------------------------------
    
    /**
     * Show Header
     *
     * @access    public
     */        
    function show_header()
    {        
        // Do anything you want in here

        // You will need to use $this->_CI instead of plain old $this
        
        $this->_CI->load->view('whatever');
    }
}

Name that file layout.php and plop it in your application/libraries folder.

To use, autoload 'layout' and in your constructors do:
Code:
$this->layout->show_header();

Obviously you can add functions as your heart desires. Here's some complimentary reading.

Hope that helps.


Messages In This Thread
Repeating, my own function, how? - by El Forum - 05-13-2008, 09:52 AM
Repeating, my own function, how? - by El Forum - 05-13-2008, 11:08 AM
Repeating, my own function, how? - by El Forum - 05-15-2008, 07:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB