Welcome Guest, Not a member yet? Register   Sign In
Repeat function in every controller
#1

[eluser]Unknown[/eluser]
Hi! (sorry for my english)

I have a question. How I can repeat some function in CI...I mean...in every controller?

I would check some information in database every time when user refresh page ...for example: new user messages or unread posts and paste it to part of view (template?) (yyy user panel). And I want to show the user panel in every page of my website.

In symfony there is something called "components" (logic + view & repeat)....

How do it in CI? ...call some function in every contructor of controller ?

Thanks!
#2

[eluser]wex69[/eluser]
Im not entirely sure, but i guess you would extend the Controller class.

Using My_Controller etc, you can create a controller class which checks for messeages on each load?
(Doc: http://ellislab.com/codeigniter/user-gui...asses.html)

Im searching for the same thing, so let me know if you find a good soloution Smile

This might do it:
http://ellislab.com/forums/viewthread/173797/
http://philsturgeon.co.uk/news/2010/02/C...ing-it-DRY




Theme © iAndrew 2016 - Forum software by © MyBB