![]() |
hmvc and helpers - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: hmvc and helpers (/showthread.php?tid=57865) |
hmvc and helpers - El Forum - 04-20-2013 [eluser]boytun[/eluser] Hello In my application I use the Hmvc structure. the main structure of my application is like this Code: +application but when I try to excute the page,everything work fun, only the title of my page is not showed perfectly, and I get this error: Quote:A PHP Error was encountered this is my cms_helpers's fils: Code: <?php and this my controller: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Thanks for any hints. Regards boytun hmvc and helpers - El Forum - 04-20-2013 [eluser]wiredesignz[/eluser] Your Page controller is descended from the MX_Controller class and any variables it has defined are local to it only, and are not available to the CI super object. Thus the $data variable is local only to the Page controller, hence the error: undefined property CI::$data. Using get_instance() in your helper will not give you access to any module controller content. Edit: If you insist on using a helper to set a class variable of a controller (bad practice IMO) then you should pass the controller instance to the helper also. hmvc and helpers - El Forum - 04-20-2013 [eluser]boytun[/eluser] Thanks wiredesignz. ![]() I just want to tell you that I'm beginner in CI, but about php5 I have the basics , so that why I ask many questions in the forum in order to learn and explore more the framework. ![]() About my question,when I applay your notes, the error is disappeared, but I did not get the desired result concerned the title tag. this is the modified code: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); the helper: Code: <?php |