Hi guys, I want my users to be able to save a favourites list.
So I have a bunch of pages (about 30) with a table of data, and other content on them. The data is pretty important, and an average user will normally access the content of at least 5 different tables on a frequent basis.
I'm wanting to set up a "My favourites" type page, which will only display the content of those tables they actually need. I thought the easiest way to do this is to set a cookie value for each of those tables. So under the table I'd have a "add to favourites" button. This in theory should write a cookie. The "My favourites" page would simply display the divs (assets) that are written to the cookies.
I've got as far as the code below, but it doesn't seem to write my cookie:
BUTTON:
<div id="addToFav1" style="cursor:pointer;height:30px;width:120px;background-color:blue;">Add to favourites</div>
If you want to purely use Matrix, which in this case I think is a great idea, you can easily create a trigger that will link a page under the current user. That way, you can late list all of the "favorites" that are linked by that user.
Here is the setup:
Then just create a link with a specific class and use some jQuery:
Are the registered logged in users or public users? If the former, then definitely store the data in Matrix.
Hey Nic I’ve used the link under user method before, but at the time I wondered whether if used in excess it would create a complex web of a lot of links, and if any changes cascade anywhere settings could be difficult to preserve, or something could accidentally have its status changed.
I recently tried a solution for registered users where if they favourite/follow a page, their user assetid is added to a private metadata field for the page containing an array of the asset ids of users who’ve favourited the page. This solution meant I could use triggers to send emails to the arrays, no strain was placed on the system, and if a page was moved or deleted, not much else happened. The other cool thing was I could use a regex match keyword on the layout to display whether the current user had favourited the page.
So Wardy, are your users registered and logged in?
Hey Nic I've used the link under user method before, but at the time I wondered whether if used in excess it would create a complex web of a lot of links, and if any changes cascade anywhere settings could be difficult to preserve, or something could accidentally have its status changed.
It shouldn't cause any issues at all that I can think of. I think what you described would be a non-issue IMO. :)
Excellent. I feel much better about using the trigger/link setup for my previous employer now! Hey Wardie if you do use the trigger/link method, just make sure you don’t cascade any changes you make to users or groups that you wouldn’t want to apply to pages linked beneath them.
Excellent. I feel much better about using the trigger/link setup for my previous employer now! Hey Wardie if you do use the trigger/link method, just make sure you don't cascade any changes you make to users or groups that you wouldn't want to apply to pages linked beneath them.
Alternately you could create a NOTICE link instead, which I don't think would be affected if a status change was cascaded. Although I have not tested this.
Thanks guys, yeah my solution would be for public users, so I need to use a method that utilises the client side. I'll press ahead with the cookies method, then I'll try the localStorage one.
I recently tried a solution for registered users where if they favourite/follow a page, their user assetid is added to a private metadata field for the page containing an array of the asset ids of users who've favourited the page. This solution meant I could use triggers to send emails to the arrays, no strain was placed on the system, and if a page was moved or deleted, not much else happened. The other cool thing was I could use a regex match keyword on the layout to display whether the current user had favourited the page.
Jhewitt - I am trying to create this exact same functionality.. how do you go about creating the array of asset ids in the one metadata field? I have tried using a trigger to set a multiple text metadata value with the current user but it over-rides the value rather than adding a new value to it, so there is only ever one user assetid as the value at any one time... any pointers appreciated, thx,