1
57

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 class="clickhere" 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', 'js.cookie'); ?>
  17. <script>
  18. $('#consentyes').click(function() {
  19.     Cookies.set('cookieconsent', 1, { path: '/', sameSite: 'lax' });
  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

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].