0

I'm currently working on a project using CodeIgniter web framework. I just have this question in mind: how do I create a notification feature? Specifically, this notification feature would cover some activities that are happening in my application. Like for example, a student requested an appointment with a guidance counselor. How do I create the notification that will be sent to the guidance counselor?

I have an idea about how the notification will be inserted in the database, but I'm not quite so sure. Another question: What if a notification comes from one user and should be sent to many users? How do I write it in the database? And, how do I have a real time notification? I mean, when a user no longer needs to refresh the page if a new notification has been sent to him or her, a notification bubble or whatever will just popout somewhere. Of course, this needs a javascript/jquery/ajax (which I'm really not enthusiastic about haha), and I have an idea how it'll work, but then again, I'm not quite so sure. Can someone help me? I just need a brief walk-through, or something that will get me started or that will give me an idea about the things I need and the things I have to learn.

Thank you in advance for the answers.

2
  • What have you tried so far ? what kind of notification ? Browser Notification ? Commented Aug 13, 2013 at 5:26
  • I haven't really tried anything yet because I'm working on another module, amd I'm still researching for this notif feature. But my plan is, have a notification table with a notification status(not seen, or seen), and when there is a not yet seen notif, it'll be on the notification list of a user. Of course, it isn't real time, and probably inefficient, so I still need to learn more. Commented Aug 13, 2013 at 5:28

1 Answer 1

2

You can organize your database like this:

users

- user_id
- name
- etc.

notifications

- notification_id
- content
- date

users_notifications

- notification_id
- user_id
- view_date

Then you just have to play with datas.

For the ajax, you can make a route, or a controller like

mysite/notifications_controller with actions:

  • index: used to fetch notifications from current user and send it to your browser. You can output them in json. Call it with ajax. Pull it with a periodic call.
  • mark_as_read: used to mark a notificiation as readed. You pass the id on an ajax call (when the user click on the notification or whatever).

If you want to display live notifications, I suggest you to learn NodeJS :).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.