Dion, why won't the category toggle script save cookies!?
Posted October 14th 2011, 4:14pm
I followed everything to it, saved and they appeared as they should.
I then toggled them and reloaded to see that they go back to the original state & not save anything :(

here's the script...
<style>
.expand, .contract {position: absolute; top: 6px; right: 10px; cursor: pointer; width: 9px; height: 9px; background: url(http://illiweb.com/fa/m/tabs_more1.gif);}
.contract {background: url(http://illiweb.com/fa/m/tabs_less1.gif);}</style>

<script type="text/javascript">
function toggleLTcategory(cat) {
var cid=cat.id;
var button=document.getElementById('b'+cid);
if (cat.style.display=='none') {
cat.style.display='block';
button.className='contract';
my_setcookie('_' + cid, '', true);
}
else {
cat.style.display='none';
button.className='expand';
my_setcookie('_' + cid, '1', true);
}
}

jQuery(function () {
x=jQuery('.main-head .page-title').get();
for (i=0; i<x.length; i++) {
x[i].style.position='relative';
var cid='c'+String(i+1);
x[i].parentNode.nextSibling.setAttribute('id',cid);
x[i].parentNode.nextSibling.style.display='block';
var y='<div id="b'+cid+'" class="contract" onclick="toggleLTcategory(this.parentNode.parentNode.nextSibling);"></div>';
x[i].innerHTML=x[i].innerHTML+y;
}

cookies = document . cookie.split('; ');
for (i in cookies) {
if (cookies[i].charAt(0) == '_') {
cookie = cookies[i].split('=');
if (cookie[1] == '1') {
cid = cookie[0].substring(1);
if (document.getElementById(cid)) {toggleLTcategory(cid);}
}
}
}
});
</script>
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted October 14th 2011, 6:47pm
This line:

cookies = document . cookie.split('; ');

should be:

cookies = document.cookie.split('; ');
φ
Posts: 1553
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 354
Dion, why won't the category toggle script save cookies!?
Posted October 15th 2011, 3:01am
Followed what you input<3 thanks for replying! I refreshed or "reloaded the page" and they still seem to go back to the original state<3

Test forum here... http://teststss.forumotion.co.uk/
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted October 16th 2011, 5:26am
!?<3
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted October 16th 2011, 3:23pm
You would need to clear your cache.
φ
Posts: 35
Joined: September 3rd 2011, 11:00pm
Likes Received: 2
Dion, why won't the category toggle script save cookies!?
Posted October 16th 2011, 3:25pm
That has nothing to do with it! The cookies would save without clearing the Cache, after all this is a new computer.

Clearing the Cache gets RID of Data!
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted October 16th 2011, 4:19pm
Why don't you try? You always want new data for cache.
φ
Posts: 35
Joined: September 3rd 2011, 11:00pm
Likes Received: 2
Dion, why won't the category toggle script save cookies!?
Posted October 16th 2011, 4:40pm
I do it everyday ;) ++ this is a new computer, baby!
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted October 17th 2011, 11:37am
The JS code should be in a javascript file, not in a template.

On my list of things to do is to write up a tutorial for how to properly add scripts to templates. But that won't happen until I get more time, which should be in a few weeks.
φ
Posts: 1553
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 354
Dion, why won't the category toggle script save cookies!?
Posted October 17th 2011, 4:53pm
still not saving the cookie, I've tried HTML pages, Javascript pages, ripway, & other javascript/file hosts & still get the same result :(
I <3 YOU DION!
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted January 2nd 2012, 7:48am
@bears: check this

punbb category toggle script
φ
Posts: 16
Joined: October 3rd 2011, 11:00pm
Location: india
Likes Given: 18
Dion, why won't the category toggle script save cookies!?
Posted February 10th 2012, 2:17pm
it works.. you only fill in the correct code..
φ
Posts:
Avatar
Guest
Dion, why won't the category toggle script save cookies!?
Posted February 10th 2012, 5:27pm
i used the tut on FM about category toggle... i put the codes in the right places.... it won't work...

i;m using phpbb3
φ
Posts:
Avatar
Guest
Topic locked
13 posts

Who is online

Users browsing this forum: No registered users and 0 guests