Call a controller from a Model

#1
[eluser]Alface[/eluser]
First I need to know, I know MVC.
I realy need to do it.

Code:
<?php
class Site extends Controller {
    function Site(){
        parent::Controller();
    }

    function say(){
             echo 'hello';
        }
}

Code:
<?php
class Something_model extends Model {

    public function __construct(){
        parent::Model();
    }
    
    function dolikecontroller(){
        // something to call 'say' function from controller
    }
}


There is no libary extention for do it?

Thanks

#2
[eluser]theshiftexchange[/eluser]
Whatever your trying to do - wouldnt it be easier making a library yourself, and then have both the controller and the model call that library? Thus achieving the same goal but in true MVC format?

#3
[eluser]danmontgomery[/eluser]
Code:
function dolikecontroller() {
    $CI =& get_instance();
    $CI->say();
}

#4
[eluser]Alface[/eluser]
Didn't worked.
I was tring to make a xajax aplication faster..

I solved it calling the same function with call xajax on controller

#5
[eluser]stuffradio[/eluser]
Woah woah woah, why are you trying to do that? Isn't that kind of backwards!?

#6
[eluser]Alface[/eluser]
[quote author="stuffradio" date="1272752731"]Woah woah woah, why are you trying to do that? Isn't that kind of backwards!?[/quote]

Because the Database access is done on controller (I'm using ORM)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.