Data transfer between controller functions |
[eluser]n0xie[/eluser]
[quote author="Mareshal" date="1245617565"]I tried n0xie's suggestion. I only try to use the data from another function in same controller, and that was only a simple example.[/quote] Sorry my bad... My example was a little bit wrong. Change the last function call to $this->index(): Code: function subscribe(){
[eluser]Mareshal[/eluser]
aaaa, so index uses function renderpage like a third party, and all data from other function inside same controller are passed trought index function. I think I understand now. But how to call another function from another controller? is this possible?
[eluser]n0xie[/eluser]
[quote author="Mareshal" date="1245682915"] But how to call another function from another controller? is this possible?[/quote] The short answer is 'no'. The long answer is 'yes'. The way CI normally works it's not possible but you can change this behaviour (like most behaviour) to your liking. There are several good posts about how to approach this, so I recommend you check out the search function.
[eluser]Mareshal[/eluser]
Ok, I know aobut search function, but the problem is what to search? edit: I think this is the answer -> http://ellislab.com/forums/viewthread/119273/ "Extending controller classes is more appropriate than creating libraries. " I can't test it now, but is this the answer?
[eluser]n0xie[/eluser]
Well this isn't Python. There isn't 1 right way to do things: there are many ways to achieve what you want. It's up to you to decide how you want to do it
[eluser]wiredesignz[/eluser]
Ignore the cryptic bullshit. Yes, Extending controller classes is more appropriate than creating libraries in most circumstances and you can call a controller method from another controller by using the HMVC extensions. See my signature below.
[eluser]n0xie[/eluser]
[quote author="wiredesignz" date="1245700414"]Ignore the cryptic bullshit. [/quote] What exactly is cryptic about my replies?
[eluser]wiredesignz[/eluser]
Quote:The short answer is 'no'. The long answer is 'yes'. ...and WTF has Python got to do with CI or the OP's question?
[eluser]n0xie[/eluser]
[quote author="wiredesignz" date="1245701413"]WTF has Python to do with CI?[/quote] Can you read?? Quote:Well this isn’t Python. There isn’t 1 right way to do things Quote:Zen of Python :
[eluser]TheFuzzy0ne[/eluser]
wiredesigns is just like a Slinky - Not really good for anything but you can't help but smile when you push him down the stairs. |
Welcome Guest, Not a member yet? Register Sign In |