Welcome Guest, Not a member yet? Register   Sign In
An easy way to execute a method from the view ..
#2

[eluser]srobet[/eluser]
You can write it at library.

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



class Templating{
function top_menu()
{
     $themenu='<ul><li>Sample Menu</li></ul>';
     $return $themenu;
}
}

In Controller load this library and call the menu function.
Code:
function index()
{
    $this->load->library('templating');
    $data['top_menu']=$this->templating->top_menu();
    $this->load->view('the_template',$data);
}

And at your views code, designer just write :
Code:
&lt;?=$top_menu;?&gt;
to create the top menu.


CMIIW


Messages In This Thread
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 05:33 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 05:45 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 05:55 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:00 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:05 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:16 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:26 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:40 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:50 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:58 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:19 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:24 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:35 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:39 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:44 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:54 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 08:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB