How do I use cookies from the browser to uniformly change the appearance of all webpages on my ToolTwist site?
It seems excessive to put boilerplate code in a production helper for every widget that needs to know if the user is logged in or not.
How do I use cookies from the browser to uniformly change the appearance of all webpages on my ToolTwist site?
It seems excessive to put boilerplate code in a production helper for every widget that needs to know if the user is logged in or not.
If you only want the cookie to change the appearance of a single page, you can use a request handler. However, it sounds like you want an across-the-board change, which requires an interceptor.
From the Eclipse Workbench, select File->New->Other..., then select Interceptor under the ToolTwist folder. The template code and config file contains comments and examples. In your case, you can check the user is logged in and redirect to a different page (navpoint) if not. If logged in, set the cookie if it's not already set. It's a good idea to store it's value in a session variable for later use.
In your production helpers and generated widget code, you can use the session variable to control styles, layout, etc.
Be careful though - interceptors are invoked for every page access to your site, so keep it lean and mean.