close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How does redirect work within cookies toolkit?

Thread began 10/07/2009 12:07 pm by i.edwards384429 | Last modified 10/14/2009 1:07 am by i.edwards384429 | 4762 views | 11 replies |

i.edwards384429

How does redirect work within cookies toolkit?

Hi

can I just clarify a couple of points relating to re direction?

Does the extension automaticaly create a cookie if I just type a name into the wizard window

and

Do I have to place a form on the page?

I note from an example posted in an earlier string that this may be the case

thanks

Ian

Sign in to reply to this post

Eric Mittman

When you use the cookies toolkit you can create a cookie on a page by specifying the name. When you load that page the cookie will be created.

As for the form it is not required to have cookies on the page but there are things you can do with a form like store form values in a cookie. Please describe what you are trying to accomplish and what you have tried and the results you are getting. We can help get you going in the right direction.

Sign in to reply to this post

i.edwards384429

re direct

Hi

this has been "sort of" answered in another thread but as a PHP cookie novice - well below that - I'm a bit lost ok totaly lost because I can't find an idiot guide on the site ;-(

Simply on an Index.php page I need the page to redirect to another page/splash screen to display special offers etc. I want to use a cookie because I need the page to display only every four weeks.

Thanks

Ian

Sign in to reply to this post

Eric Mittman

One way to do this would be to set a cookie on the splash screen page. Then on your index page you check to see if the cookie is set, if it is not then you should send the user to the splash screen page.

To do this you just need to go to Server Behaviors > Cookies Toolkit > Set Cookie value. Use the before page load trigger, then give it a name and value.

Then on your index page you can add in custom code like this to redirect if this cookie is not set:

php:
<?php

if( !(isset($_COOKIE["<the name of your cookie>"])) )     {
  
header("Location: <your splash screen page>");
}
?>



You would need to update the name of the cookie to match the one you set, then put in the page where you would like the user to go to.

Sign in to reply to this post

i.edwards384429

page not found

Hi

sorry to be a pain but I added this to my index.php page above the doctype

<?php
if( !(isset($_COOKIE["<splashCookie>"])) ) {
header("Location: <http://www.ashburyblinds.co.uk/splash.php>");
}
?>

In the page splash.php

I created following your instructions

<?php
if ("" == "") {
setcookie("splashCookie", "visited", time()+(60*60*24*7), "/", "", 0);
}
?>

If I now upload the two files and type in www.ashburyblinds.co.uk


I get a page not found.

Clearly I've missed something out, any ideas what?

thanks

Ian

Sign in to reply to this post

Eric Mittman

I should have explained this a little better, the values inside of the angle brackets should be replaced, including the angle brackets like this:

php:
<?php
if( !(isset($_COOKIE["splashCookie"])) ) {
header("Location: http://www.ashburyblinds.co.uk/splash.php");
}
?>



You could just put in the name of the page there as well, it does not need to be an absolute page reference, you can just have splash.php.

Sign in to reply to this post

i.edwards384429

still no go

Hi

sorry to be a pain but still can't get this to work

in my index.php above the doctype I have

<?php
if( !(isset($_COOKIE["<splashCookie>"])) ) {
header("Location: <http://www.ashburyblinds.co.uk/splash.php>");
}
?>


on the page splash.php in the head section I have:

<script type="text/javascript">
<!--
function WA_cookieRedirect(CookieObj,Location,Alike,CookieName,CookieValue,RedirectTo,NewWindow) {
if ((CookieObj.getValue(CookieName)==CookieValue)==Alike) {
if (NewWindow)
window.open(RedirectTo);
else
Location.location.href=RedirectTo;
}
}
//-->
</script>


when I type in www.ashburyblinds.co.uk

I get a 400 error

thanks

Ian

Sign in to reply to this post

i.edwards384429

additional

Hi

just noticed that my body declaration looks like this:

<body onLoad="P7_Uberlink('uberlink','menulist');WA_cookieRedirect(WA_CookieObj,document,true,'splashCookie','visited','splash.php',false)">


cheers

Ian

Sign in to reply to this post

i.edwards384429

getting there

Hi

I seem to have made some progress.

If I type in

www.ashburyblinds.co.uk

it does not take me to

splash.php

Perfect!!!!

However when I close Ie and re open and type in

www.ashburyblinds.co.uk


It still takes me to

splash.php

the cookie code is:

<script src="scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function WA_cookieRedirect(CookieObj,Location,Alike,CookieName,CookieValue,RedirectTo,NewWindow) {
if ((CookieObj.getValue(CookieName)==CookieValue)==Alike) {
if (NewWindow)
window.open(RedirectTo);
else
Location.location.href=RedirectTo;
}
}
//-->
</script>
</head>
<body onLoad="P7_Uberlink('uberlink','menulist');WA_cookieRedirect(WA_CookieObj,document,true,'splashCookie','visited','splash.php',false)">

Any ideas?

thanks

Ian

Sign in to reply to this post

i.edwards384429

update

Hi

think I've got it working ;-)

watch this space

Ian

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...