RW Themes are Eating my Cookies!


(Brandon Scott Corlett) #1

Greetings everyone,

I am playing with creating cookies using PHP. The problem I am encountering is that I need to set the cookie before any other content is loaded onto the page. This presents a challenge with RapidWeaver as the themes load content before the content I put into the page.

Anyone have any ideas how I can get around this other than not using a theme at all?

Cheers,

Brandon


(Doug Bennett) #2

The prefix code area should do what you want.
Page level:

Site wide:


(Brandon Scott Corlett) #3

Thanks @teefers! I completely forgot that was there.

Now to work out how I can build a stack that puts content into the prefix. =P


(Doug Bennett) #4

Oh you didn’t say stacks.
I would guess your looking to do the PHP:
session_start();
If that is the case there is an option in the stacks Property List:
http://api.yourhead.com/keys/requiresPhpSession/


(Brandon Scott Corlett) #5

I’m doing both =P

I start by coding outside of RW, then in a HTML plugin page within RW, then a stack.


(Doug Bennett) #6

Don’t know if I understand what you are saying with

If what you a doing trying to start or resume a session then for the native HTML page(s) and the HTML plugin(s) page you would add this:

<?php session_start(); ?>

Since a start session would need to be the first thing make sure it’s the first line in the native page(s) and use the Prefix for the RW plugin page.

For the stack you could use stacks Property List.