Author |
Message |
doffer83
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/d5c522c25233365e6b83d.jpg)
Joined: Apr 17, 2011
Posts: 117
Location: Amsterdam
|
Posted:
Mon Dec 17, 2012 7:05 pm |
|
In the Netherlands (new rulzz) we must put cookies accept button on the site voor the visitors... I would like to put also on my little 2 sites..
do you have to make such a warning.. you know that the visitor has to accept cookies
kind regards |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/3234de284ee21bd39eecd.jpg)
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Mon Dec 17, 2012 8:58 pm |
|
There are several jquery cookie prompt scripts out there. You could use something like cPrompt https://github.com/michaelw90/cPrompt You would just need to add cprompt.min.js to your includes/jquery folder and create a file in includes/addons named head-Cookie_Prompt.php and include the following code in it:
Code:
<?php
if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Cookie_Prompt.php')) {
Header('Location: ../../index.php');
die();
}
addJSToHead('includes/jquery/jquery.js', 'file');
addJSToHead('includes/jquery/cprompt.min.js', 'file');
$inlineJS = '<script type="text/javascript">
cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "modules.php?name=Legal&op=privacy";
</script>'."\n";
addJSToHead($inlineJS,'inline');
|
|
_________________ Only registered users can see links on this board! Get registered or login!
Last edited by nuken on Mon Feb 25, 2013 7:06 pm; edited 1 time in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
doffer83
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 17, 2012 9:54 pm |
|
nuken, mijn fault sorry I had to write it in my first post.. my little website is an old phpnuke... (long stoy when I discoverd raven my site was already online months ago)
I can put the next code in head.php
echo "<script language=\"javascript\" src=\"includes/cprompt.min.js\" type=\"text/javascript\"></script>";
echo "<script language=\"javascript\" src=\"includes/jquery.js\" type=\"text/javascript\"></script>";
and after that I don't know ... or is that enough? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 17, 2012 10:09 pm |
|
You would need to include jquery first. You would then need to add Code:
echo '<script type="text/javascript">
cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "link to your privacy policy";
</script>';
|
Of course "link to your privacy policy" would need to be changed to the actual link to your privacy policy. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jane65
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Feb 24, 2009
Posts: 81
Location: UK
|
Posted:
Mon Feb 25, 2013 6:22 pm |
|
Hi,
I'm trying to add the cprompt cookie warning as described in these posts, so far I've added cprompt.min.js to includes/jquery folder and created a file in includes/addons named head-Cookie_Prompt.php including the code given here for the file but I don't quite understand what code I need to add next and what file I need to add it too to make the cookie prompt visible on my index page. I'm using Ravennuke 2.5.1.
Thank you in advance for any help with this. ![Smile](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Feb 25, 2013 7:11 pm |
|
There is no next. If you add the cprompt.min.js and created the head-Cookie_Prompt.php with
Code:
<?php
if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Cookie_Prompt.php')) {
Header('Location: ../../index.php');
die();
}
addJSToHead('includes/jquery/jquery.js', 'file');
addJSToHead('includes/jquery/cprompt.min.js', 'file');
$inlineJS = '<script type="text/javascript">
cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "modules.php?name=Legal&op=privacy";
</script>'."\n";
addJSToHead($inlineJS,'inline');
|
It will show up above your header. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jane65
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Feb 25, 2013 7:16 pm |
|
I've managed to get it working now. There are two files in cprompt that need to be added to the jquery folder, so apart from the cprompt.min.js file there is another called cprompt.js. Once I added that file to the jquery folder and also included it in the code given by nuken as shown below it worked immediately.
Code:<?php
if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Cookie_Prompt.php')) {
Header('Location: ../../index.php');
die();
}
addJSToHead('includes/jquery/jquery.js', 'file');
addJSToHead('includes/jquery/cprompt.min.js', 'file');
addJSToHead('includes/jquery/cprompt.js', 'file');
$inlineJS = '<script type="text/javascript">
cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "modules.php?name=Legal&op=privacy";
</script>'."\n";
addJSToHead($inlineJS,'inline');
|
|
Last edited by jane65 on Mon Feb 25, 2013 7:21 pm; edited 1 time in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Feb 25, 2013 7:20 pm |
|
the cprompt.min.js and the cprompt.js are the same exact file only one has all the spaces removed from it, ie minified.... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jane65
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Feb 25, 2013 7:20 pm |
|
Thanks for your reply nuken, I've only just seen your post after posting myself, I did do that but it didn't show up, but it has now after adding the second file in the cprompt folder. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|