Welcome Guest, Not a member yet? Register   Sign In
Change controller class property
#6

[eluser]jedd[/eluser]
[quote author="yabune" date="1258930217"]
If I call the show function I get bbb.
And if I call the update function I still get bbb and not xxxxx.

Is it because when I redirect a new Pages object is created?
[/quote]

Well, yes. It's actually a whole new program instance that is run. It might have a sense of nostalgia for previous activity, but it certainly won't remember the variable that was instantiated the last time it was run.

As evinced by making a change like this to your example code:
Code:
function update($page)
    {
        $this->load->helper('url');
        $this->abc = 'xxxxx';
        $this->show();
        // redirect('/pages/show/'.$page.'/1', 'location');

Quote:How do I pass a string to another function?

In the URL, generally, is the easiest and best place (for varying values of best). Alternatively in POST data, or Session data. But I agree with you about keeping as much data as possible in the URL - usually a good thing.


Messages In This Thread
Change controller class property - by El Forum - 11-22-2009, 08:27 AM
Change controller class property - by El Forum - 11-22-2009, 09:22 AM
Change controller class property - by El Forum - 11-22-2009, 09:25 AM
Change controller class property - by El Forum - 11-22-2009, 09:33 AM
Change controller class property - by El Forum - 11-22-2009, 10:50 AM
Change controller class property - by El Forum - 11-22-2009, 11:10 AM
Change controller class property - by El Forum - 11-22-2009, 11:18 AM
Change controller class property - by El Forum - 11-22-2009, 11:33 AM
Change controller class property - by El Forum - 11-22-2009, 12:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB