3.1 Import files
< ?php // Place at the top of each page
<?php // Place at the top of every page
// Start up the cookie tool
require_once 'cookie_tool/cookie_tool.php';
require_once 'cookie_tool/config.php';
$cookie_tool = new CookieTool($cookie_tool); ?>
- Place the above mentioned PHP code at the top of every page, in front of all the other HTML code forms.
- Make sure the links in this code are set correctly. In the example, the cookie_tool folder is in the same directory as the webpage where you copied the code above into.
< link rel="stylesheet" type="text/css" href="cookie_tool/style.css" />
< script type="text/javascript" src="cookie_tool/main.js">
- Afterwards place on every page within your website linkings to style.css and main.js behind
<head>
and before</head>
.
3.2 Show pop-up
<?php // Place before </body>
$cookie_tool->display(); ?>
- Finally, place the code mentioned above before the end of the body, so before:
</body>
. This code calls upon the pop-up and ensures it to appear if the visitor has not accepted any cookies yet.
Go to step 4: implementation of the cookie script