[solved]Intro page, cookie?[/solved]

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
vinyl
Forum Members
Forum Members
Posts: 149
Joined: Mon Jul 13, 2009 8:18 pm

[solved]Intro page, cookie?[/solved]

Post by vinyl »

I am busy making a website in which something of an intro page should be included. Once shown it won't be seen again untill you clear your cookies.

Since I am using CMSMS it complicates that a bit. I would like to use some module functionality on that page (calendar items). Any ideas on how to make a intro page that only shows once?

Anyone done this before?
Last edited by vinyl on Wed Jul 06, 2011 6:02 pm, edited 1 time in total.
replytomk3

Re: Intro page, cookie?

Post by replytomk3 »

There is a module in the Forge
vinyl
Forum Members
Forum Members
Posts: 149
Joined: Mon Jul 13, 2009 8:18 pm

Re: Intro page, cookie?

Post by vinyl »

You know the name? I have been looking for "Cookie", "Intro", "Splash" etc..
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Intro page, cookie?

Post by Jos »

just create a UDT that checks if the cookie is set, then redirects to another page, else set the cookie.
vinyl
Forum Members
Forum Members
Posts: 149
Joined: Mon Jul 13, 2009 8:18 pm

Re: Intro page, cookie?

Post by vinyl »

I solved this doing the following (some of it I written myself other part is from the web, possible Calguy?)

Code: Select all

if(!$_COOKIE["intro"]) {
// page alias for the intro page
$redirect = 'intro';
// cookie settings
$c_name = "intro";
$c_days = 30; //in days
$c_expire = 86400 * $c_days;


global $gCms;

setcookie("intro",1, time()+$c_expire,'/','.your_web_page'); 

$manager =& $gCms->GetHierarchyManager();
    $node =& $manager->sureGetNodeByAlias($redirect);
    $content =& $node->GetContent();
    if (isset($content) && is_object($content))
       {
         if ($content->GetURL() != '')
         {
            redirect($content->GetURL());
         }
       }
}
You include this in your default page. What it does is check if the intro cookie is there. If it is not, it will set the cookie and redirect you to an intro page.
Post Reply

Return to “The Lounge”