Welcome Guest, Not a member yet? Register   Sign In
I have extended Controller, how to use a function in view files?

Hi there.

I have extended the Controller class (with BaseController), and I have a custom _load function in that.

When I do this:
class Dummy extends BaseController {

function index(){
parent::_load('blabla', false);


Everything works as it should Smile The loader loads up a "load file" which then loads up a normal view file. The problem is, how can i use the _load function WITHIN one of my view files? Say I wanted to do this

&lt;?php parent::_load('blabla', false);

Though, that doesnt work.


the fast reply is that controllers are for handling http requests that come from the browser/user; they are not designed for handling calls from a view (or anywhere else for that matter). that is why they are called controllers. if you want to reuse code in the way you describe, make a plugin or helper or library.

if you want to call controllers from other controllers (or embed controller calls in a view) you'll need to check out wiredesignz's "Modular Extensions" (I feel an eerie sense of deja vu) ;-) check the wiki - it's pretty easy to set up and you'll be calling controllers from views in just a few hours.


Hah! Thanks again, sophistry!

I also felt a slight deja vu when reading your post.


Theme © iAndrew 2016 - Forum software by © MyBB