Welcome Guest, Not a member yet? Register   Sign In
what is the best way to include feature from one controller to another ?
#1

[eluser]dhaulagiri[/eluser]
Hi all,

I am just wondering how to do this, if i have a latest_post feature in my blog controller, what is the best way to show the same latest_post in News Controller ? Please help. Thanks.

It was easy to include in old way php but just getting confuse now.
#2

[eluser]ecsyle31[/eluser]
Most likely you have a method in your Blog Model to retrieve latest posts correct? Just include the model in your news controller and grab the lastest posts that way.
#3

[eluser]Vheissu[/eluser]
If you're not using models to perform your database stuff (which you should be anyway) and instead interfacing with your database via your controller, you should create a MY_Controller and then place it into your libraries folder (if you're using 1.7.2) or if you're using 2.0 then put it into your core folder and then when you define your controllers do the following:

Code:
class Home extends MY_Controller {

    function Home()
    {
        parent::My_Controller();
    }

}
#4

[eluser]nzmike[/eluser]
Or put it in a library




Theme © iAndrew 2016 - Forum software by © MyBB