Welcome Guest, Not a member yet? Register   Sign In
method call to other methods
#1

[eluser]atoleon[/eluser]
I have a controller wich there are some method wich do different tasks but all of them load the same view.
Is posible that only one method load the view and the others method call to this method when it finish the task and load the view?
#2

[eluser]SPeed_FANat1c[/eluser]
I don't understand the question.

Code:
function f1()
{
  $this->load->view('v');
}

function f2()
{
  $this->load->view('v');
}

function f3()
{
  $this->load->view('v');
}

"Is posible that only one method load the view"

Yeah, it is possible if you add some checking before loading view -
Code:
if($I_want_load)
    $this->load->view('v');


But what do you want to say with this "and the others method call to this method when it finish the task and load the view?" ?
#3

[eluser]atoleon[/eluser]
Can i make this:
[quote author="SPeed_FANat1c" date="1288800646"]I don't understand the question.

Code:
function f1()
{
  $this->load->view('v');
}

function f2()
{
  //$this->load->view('v');
  f1(); //to load view ('v')
}

function f3()
{
  //$this->load->view('v');
  f1(); //to load view ('v');
}

"Is posible that only one method load the view"

Yeah, it is possible if you add some checking before loading view -
Code:
if($I_want_load)
    $this->load->view('v');


But what do you want to say with this "and the others method call to this method when it finish the task and load the view?" ?[/quote]
#4

[eluser]smilie[/eluser]
Hi,

Yes, it is possible.

Code:
function loadPage($param)
{
    $this->load->view('v',$param);
}

function shoes()
{
   # some coding happens here...
   # Coding done, load page
   $param = ...
   $this->loadPage($param);
}

function house()
{
   # Again, some coding here...
   $param = ...
   $this->loadPage($param);
}

In above code, I have added passing variables to loadPage() function, as I presume you may need them :-)

Cheers,
Smilie
#5

[eluser]atoleon[/eluser]
Thankyou very much. It will be useful for my me.




Theme © iAndrew 2016 - Forum software by © MyBB