Welcome Guest, Not a member yet? Register   Sign In
Creating a "Saved Favorites" Function?
#1

[eluser]MatthewSchenker[/eluser]
Hello Everyone,
I've been building in CodeIgniter for the past few months, and like it more and more every day!

But I've run across a challenge I'm not sure how to deal with...

How would you create a "Saved Favorites" function in CodeIgniter? I'm talking about something where logged in users could click a button and the URL of the current page is saved to a list. Then on another page the user could see the list of "favorite" pages he/she has "saved" and click on an entry to jump to that page.

I'm sure others must have done this before me. Can anyone help me out?

Thank you,
Matthew

PS: I see that Solspace has exactly what I'm looking for in ExpressionEngine (http://www.solspace.com/software/detail/favorites/). Could this be brought into CodeIgniter?
#2

[eluser]CroNiX[/eluser]
This would be very simple.

Just a table with id, user_id, url and page_title. SELECT url, page_title FROM table WHERE user_id = x. Then just make a list of links. Just use ajax or something to submit the entry.
#3

[eluser]MatthewSchenker[/eluser]
Hi CroNIX,
Thanks for the quick response. Simple for you!

Well, OK, now that you describe it, I'm pretty sure how to do it.

Thank you again for your help. This community is one of the reasons I really enjoy CodeIgniter.

Matthew
#4

[eluser]Rok Biderman[/eluser]
If there is something really simple you want to input(like an id), just make another text field in your users table called favorites, and serialize an array into it. When you need it just unserialize it and call array_push or array_diff to add and remove items.
#5

[eluser]MatthewSchenker[/eluser]
Hello Coccodrillo,
Thanks for jumping in! I appreciate the input.

OK, I see the idea. Now I've got to test it.

In the meantime, if anyone has a working example of something like this, please share it.

Thanks again,
Matthew




Theme © iAndrew 2016 - Forum software by © MyBB