views:

51

answers:

1

I want to make an application that doesn't need cookies but still has Sessions. Therefor I create the SessionID and take it in the URL with me. My problem now is that the HTML helper doesn't recognize this and all links that are outputted are without the session id.

Does CakePHP have to be told to do that or isn't there any mechanism for this? (taking the session id in every link)

+3  A: 

This is a case of "there's still PHP in CakePHP." The default HtmlHelper does not attach any session values as far as I'm aware, since Cake favors cookie sessions. You can use the standard PHP tools to change that though.

First, you'll want to customize the cookie handling. See here for details: How to bend CakePHP's session handling to your needs. Then, you'll need to decide whether to use PHP's trans-sid functionality, or use the SID constant as a means to transfer the session id. If the latter, you may want to create a custom AppHelper::url method to automatically include it in every link. See here for a solution to a similar problem: Adding a prefix to every URL in CakePHP.

deceze