Welcome Guest, Not a member yet? Register   Sign In
Private Message Count on Every Page
#1

[eluser]thody[/eluser]
So, the challenge is this:

1. Check for new private messages in the DB
2. Return results to the view
3. This must be done on every page of the site for logged in users
4. I don't want to have to call these functions explicitly on every page (calling it in each controller constructor would be ok)

I'm trying to figure out the best way to do this with CodeIgniter. I'm a little fuzzy on what the best attack is (Library, Hook, Filter, etc.).

The library approach makes the most sense to me, but if I'm calling it from the constructor I'm not sure how to send the results to the view. Maybe store the results in $this->messages and create a hook to merge $this->messages with the data array going to the view?

What do you think CI gurus?
#2

[eluser]Wuushu[/eluser]
Maybe im way off:

1) make a library (or helper) that retrieves the PM count
2) put the library or helper in autoload.php
3) call the return from the header/footer/wherever view

?
#3

[eluser]thody[/eluser]
Duh! It didn't even occur to me that I could just call it from the view directly. Thanks, that should work!




Theme © iAndrew 2016 - Forum software by © MyBB