How to use cookie manager in PHP includes?

Thanks @Teodor - this is something I was recently looking for so this is very timely :slight_smile:

However, I’ve tried to follow this, but am unable to get it to work.

I’ve specified a cookie name -:

However when I try to select the cookie in the list it shows that there are no cookies and just shows an empty list -:

I thought that maybe I shouldn’t have changed the name of the cookie manager to cookies, so I changed it back to cookies1 as per the tutorial, but then even though the cookie manager is showing the name is cookies1, when I come to select this it is still showing as cookies!

I tried restarting Wappler, but the problem persists.

I reverted this code completely and started again - this time using the name cookies1, but with the same result - I still get an empty list.

I guess it’s something I’m doing wrong here, but it’s not really clear what :confused: .

Thanks

Are you trying to set the cookie value on the same page?
Does your app have an ID set?

Yes - of course :wink: I think you can see this in the image?

That said, this is being done in an include file since I want to do this once for all pages.

Yes.

Can you explain what do you mean? What's in an include page exactly? Is this a content page or a serverside include?

No I can't really understand what exactly are you doing and where as your screenshots are quite cropped.

It's a PHP page that is included as a server side include into many other pages.

Sorry - this is pretty much the complete App Connect panel - what else did you need to see other than the App Connect side?

@cdjackson

So you created a PHP include in Wappler, using Wappler ‘move to include file’ option and included it on your pages?
Then you are trying to control the cookie value on this same PHP include page OR on some of the pages, where you have this page included?

Exactly.

Yes, as I said earlier, this is all on the same page.

No - on exactly the same page.

Please set your content page ID the same as the main page ID.

Main page:

Include page:

Also, in order for this button to work on all your pages, move (cut and paste) the state manager js from the main page to the include page:

1 Like