Help With Rendering Views in Opt-In Controller Setup

edited February 2014 in News & Announcements
Hello,
I created a class var called $view_data in MY_Controller (/fuel/application/core) class so that I could assign some session info in the constructor making it available to all child classes. This works out great for the controllers that I create manually (fuel/application/controllers). I simply call the parent constructor and then pass $this->view_data as the second parameter of the $pages->render() function. In short, I'm using a parent class variable instead of a local $vars variable. Here's where I am stuck: I cannot figure out how to make this work for pages where I have not created a controller - pages that are saved in the Fuel DB. Seems like I should change a Fuel page controller class to inherit from MY_Controller but I have no idea how to pull that off. Any suggestions? THANK YOU for any ideas you might have.

Comments

  • edited 2:59PM
    Pages created in the CMS or are using the Opt-In Controller method get routed to the fuel/modules/fuel/controllers/page_router controller which would explain why that controller variable isn't coming through. Instead of setting a variable on the controller, what about setting it in a library for it to be shared outside of the scope of a controller?
Sign In or Register to comment.