Matrix Designs & Cookies


(Squiz) #1

Hi all,


I'm trying to customise my site based on a custom cookie set on the client side. I'm wondering is there any way to read this cookie (in a similar way to the "get" parameter, for instance) to display customised content on the server.



For the most part I want to be able to:


  • Toggle which metadata fields are printed in the design.
    [*]Toggle which metadata fields are printed in a paint layout.
    [*]Rearrange items on the page depending on the cookie value.


I realise these things might not be entirely possible, but I was wondering if someone could point me in the right direction.

Cheers,
Ash.

(Nic Hubbard) #2

Well, with a mix of javascript and %globals_cookie_<variable>% you should be able to do what you are wanting.


I have also used jQuery Cookie: https://github.com/carhartl/jquery-cookie


(Squiz) #3

[quote]
Well, with a mix of javascript and %globals_cookie_<variable>% you should be able to do what you are wanting.

[/quote]



Thanks for the reply. I've already got the Javascript frontend portion done (so if necessary I technically could implement more to change the content around) but I'm looking for a more server-side approach.



From memory I think I can compare the globals_cookie_<variable> keyword in the design to toggle on and off values using the show if section, so that's pretty neat. (I didn't know about the %globals_cookie_x% keyword, so that's going to be a big help.)



So I'll have a play and see what I come up with, thanks. :slight_smile: