simple scope issue |
[eluser]ecsyle31[/eluser]
If you want to make $this->data['name'] available in your methods you should define it in the controllers constructor. The other() function has no idea what is going on in index() because you are not calling those functions from each other. This isn't a scope issue so much as a misunderstanding of OOP. http://php.net/manual/en/language.oop5.php Code: class Main extends CI_Controller { When you access http://yoursite/main/other it will echo "default_value", accessing http://yoursite.com/main/index will echo "hello". |
Messages In This Thread |
simple scope issue - by El Forum - 02-25-2011, 11:35 AM
simple scope issue - by El Forum - 02-25-2011, 11:56 AM
simple scope issue - by El Forum - 02-25-2011, 01:15 PM
simple scope issue - by El Forum - 02-26-2011, 02:32 AM
simple scope issue - by El Forum - 02-26-2011, 03:41 AM
|