Page 1 of 1
[solved]Intro page, cookie?[/solved]
Posted: Tue Jun 14, 2011 6:19 am
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?
Re: Intro page, cookie?
Posted: Tue Jun 14, 2011 10:40 pm
by replytomk3
There is a module in the Forge
Re: Intro page, cookie?
Posted: Wed Jun 15, 2011 5:55 am
by vinyl
You know the name? I have been looking for "Cookie", "Intro", "Splash" etc..
Re: Intro page, cookie?
Posted: Wed Jul 06, 2011 10:43 am
by Jos
just create a UDT that checks if the cookie is set, then redirects to another page, else set the cookie.
Re: Intro page, cookie?
Posted: Wed Jul 06, 2011 6:01 pm
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.