4

Cookie consent

To automatically display explanations about the usage of cookies by the website, just set the parameter $cookieconsent to true. The site will automatically display, whichever page is requested and only one time, a message at the very top of the page above the banner.

By using this website, you are accepting the use of cookies in accordance with our personal data policy. Note that cookies from this website are exempt from obtaining consent because strickly necessary to provide a service at the user’s request.

The view consent.phtml contains the text of the message.

consent.phtml
  1. <div id="consent">
  2. <p>By using this website, <b>you are accepting the use of cookies</b> in accordance with our personal data policy.
  3. <?php if (true): ?>
  4. <b>Note</b> that cookies from this website are exempt from obtaining consent because
  5. <i>strickly necessary to provide a service at the user’s request</i>.
  6. <?php endif; ?>
  7. <?php if (false): ?>
  8. <p>To learn more, <a href="/en/legal-information" title="Legal information">click here</a>.
  9. <?php endif; ?>
  10. </p>
  11. <?php if ($confirmcookieconsent): ?>
  12. <p><span id="consentyes" class="clickit">I get it</span></p>
  13. <?php endif; ?>
  14. </div>
  15. <?php if ($confirmcookieconsent): ?>
  16. <?php head('javascript', 'jquery.cookie'); ?>
  17. <script type="text/javascript">
  18. $('#consentyes').click(function() {
  19.     $.cookie('cookieconsent', 1, { path: '/' });
  20.     $('#consent').hide();
  21. });
  22. </script>
  23. <?php endif; ?>

The view is built by the block banner.php which passes the variable $consent to the view banner.phtml.

banner.php
  1.     $is_admin = user_has_role('administrator');
  2.     $is_writer = user_has_role('writer');
  3.  
  4.     $consent=false;

If $cookieconsent is true and if the cookie cookieconsent isn't defined, creates the cookie cookieconsent with a period of validity of one year and builds the view consent.

Adapt the text according to the caracteristics of the website. If necessary, add a page which describes in détails the use of cookies, the information which is kept, and activate the link in consent.phtml.

Comments

To add a comment, click here.