Still the same behavior.Rolf wrote:The cookie *is* set at your website
Try to play withi.e.Code: Select all
{if empty($smarty.cookies.cookie_consent)}
Code: Select all
{if !isset($smarty.cookies.cookie_consent)}
2.0.1: Cookie problem
Re: 2.0.1: Cookie problem
Regards,
Patrick
Patrick
Re: 2.0.1: Cookie problem
My suspicion: It is one of the following:
- The cookie is set but not accessible to Smarty.
- It is a caching issue.
Regards,
Patrick
Patrick
Re: 2.0.1: Cookie problem
What is the value of when you put it directly in your template.
Code: Select all
a{$smarty.cookies.cookie_consent}b
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: 2.0.1: Cookie problem
When clicking "Continue", it remainsRolf wrote:What is the value ofwhen you put it directly in your template.Code: Select all
a{$smarty.cookies.cookie_consent}b
Code: Select all
ab
Code: Select all
ayesb
Regards,
Patrick
Patrick
Re: 2.0.1: Cookie problem
Ahh, try Don't forget to change the domain name and the __ characters in the style tags
Code: Select all
<__script__ type="text/javascript">
$(".accept_cookies").click(function () {
$("#cookie_consent").toggle("slow");
$.cookie("cookie_consent", "yes", { domain: "yourdomain.com", path: "/", expires: 1095 } );
location.reload();
} );
$(document).ready(function() {
$.cookie("cookie_consent", "yes", { domain: "yourdomain.com", path: "/", expires: 1095 } );
} );
</__script>
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: 2.0.1: Cookie problem
Still the same.Rolf wrote:Ahh, tryDon't forget to change the domain name and the __ characters in the style tagsCode: Select all
<__script__ type="text/javascript"> $(".accept_cookies").click(function () { $("#cookie_consent").toggle("slow"); $.cookie("cookie_consent", "yes", { domain: "yourdomain.com", path: "/", expires: 1095 } ); location.reload(); } ); $(document).ready(function() { $.cookie("cookie_consent", "yes", { domain: "yourdomain.com", path: "/", expires: 1095 } ); } ); </__script>
Regards,
Patrick
Patrick
Re: 2.0.1: Cookie problem
I noticed the same behavior at one of my own websites, wil troubleshoot when I have a moment.
This website is on 1.12.1, so it has nothing to do with upgrade to CMSMS 2.x
This website is on 1.12.1, so it has nothing to do with upgrade to CMSMS 2.x
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: 2.0.1: Cookie problem
Could it be a browser caching issue?Rolf wrote:I noticed the same behavior at one of my own websites, wil troubleshoot when I have a moment.
This website is on 1.12.1, so it has nothing to do with upgrade to CMSMS 2.x
Regards,
Patrick
Patrick
- PinkElephant
- Forum Members
- Posts: 169
- Joined: Fri Feb 06, 2009 2:08 pm
Re: 2.0.1: Cookie problem
I'm still seeing the same pattern:pschoenb wrote:Ok, now, I have no JS errors anymore in the console
Code: Select all
if ( $(window).width() > 768) {
This is before jquery is loaded ... first here;
Code: Select all
<!-- Begin Bootstrap (JQuery) -->
<__script__ src="//code.jquery.com/jquery.min.js"></__script>
Code: Select all
<!-- Begin EU cookie consent (JQuery) -->
<__script__ type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></__script>
Re: 2.0.1: Cookie problem
Maybe cached?PinkElephant wrote:I'm still seeing the same pattern:pschoenb wrote:Ok, now, I have no JS errors anymore in the console"ReferenceError: $ is not defined"Code: Select all
if ( $(window).width() > 768) {
This is before jquery is loaded ... first here;then here;Code: Select all
<!-- Begin Bootstrap (JQuery) --> <__script__ src="//code.jquery.com/jquery.min.js"></__script>
Code: Select all
<!-- Begin EU cookie consent (JQuery) --> <__script__ type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></__script>
Bootstrap is now below the cookie consent query, and it looks like this:
Code: Select all
<!-- Begin Bootstrap (JQuery) -->
<__script__ src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></__script>
<!-- End Bootstrap (JQuery) -->
Regards,
Patrick
Patrick
- PinkElephant
- Forum Members
- Posts: 169
- Joined: Fri Feb 06, 2009 2:08 pm
Re: 2.0.1: Cookie problem
Ah, sorry - it must have been.pschoenb wrote:Maybe cached?PinkElephant wrote:"ReferenceError: $ is not defined"
Looking anew, the cookie appears to be set 'yes' on document.ready - not under (".accept_cookies").click(function () ...
Only briefly tested but IE & Chrome never shows the "#cookie_consent" opt-in (expected) but Firefox always shows it even though the cookie is set although it's a session cookie - no fixed expiry... so, confused, need coffee.
Re: 2.0.1: Cookie problem
I don't think it's a browser-specific issue. Would not make sense either.
In my opinion this part of the script should be removed:
though it won't fix the problem.
Actually the method is pretty simple so try to pinpoint the exact issue. Apparently the $smarty.cookies.cookie_consent cannot be read so find out where by placing this code at some points in you templates and 'global content blocks' (=templates too)
Another method could be:
create a udt 'read_cookie'
Then use this condition in the template:
In my opinion this part of the script should be removed:
Code: Select all
$(document).ready(function() {
$.cookie("cookie_consent", "yes", { domain: "yourdomain.com", path: "/", expires: 1095 } );
Actually the method is pretty simple so try to pinpoint the exact issue. Apparently the $smarty.cookies.cookie_consent cannot be read so find out where by placing this code at some points in you templates and 'global content blocks' (=templates too)
Code: Select all
<pre>cookies: {$smarty.cookies|print_r}</pre>
create a udt 'read_cookie'
Code: Select all
return $_COOKIE[$params['name']];
Code: Select all
{if {read_cookie name=cookie_consent} != 'yes'}<div id="cookie_consent">
<p>
...
<a class="accept_cookies">Continue</a><a href="privacy" target="_blank" class="more_info">More info...</a></p>
</div>
{/if}
Re: 2.0.1: Cookie problem
The cookie is not visible to Smarty anywhere on the page until I hit <Ctrl><Shift>-R in Firefox.velden wrote: Actually the method is pretty simple so try to pinpoint the exact issue. Apparently the $smarty.cookies.cookie_consent cannot be read so find out where by placing this code at some points in you templates and 'global content blocks' (=templates too)
Code: Select all
<pre>cookies: {$smarty.cookies|print_r}</pre>
Is this a caching issue?
As I said, I had it working with 2.0.
Regards,
Patrick
Patrick