July 30th, 2013, 04:57 AM
Cookie PHP or jQuery in Accordion script
have two websites. On this websites i want to apply jquery script "Accordion". I tried to install module "Accordion" to Drupal but this does not work well. I want to do it by myself, the script is already written and working good but I have a problem with the functionality. I want make it that: when you click on any link, the last selected Accordion bookmark was automatically opened. The solution is of course to use a sessions. My question is, what is better in this case:
- Cookies jQuery
- PHP cookies
Is there a significant difference between them? Which of them should take advantage of and use.
July 30th, 2013, 05:03 AM
Welcome to DevShed, Alex.
July 30th, 2013, 05:10 AM
Cookies are client side packets of information
Packets of information stored server side are known as "sessions" and quite often use a cookie for identification.
July 30th, 2013, 10:44 AM
I'm not 100% sure if I'm understanding your use case correctly, but it sounds like the part of the accordion you want expanded relates to whatever URL was clicked to get to the page.
If that's the case then the most full proof model would be for your PHP logic, when outputting the HTML, to set whatever needs to be set to expand the part based on the URL that kicked off the PHP.
That way if someone shares the URL and you have people going to it directly, the resulting accordion will be expanded correctly.
It's a little hard to explain.