Jojo’s hidden javascript functions

I have recently been fine tuning and fixing a few loose ends on a yoga studio website I did the development on. One of the really cool features of the site is the calendar at the bottom of every page. It gives you a really quick idea of whether there is a class and/or workshop on any given day. However the biggest feedback from Studio8 students is the each time they went to another page on the site the calendar would forget which month they were viewing.

The obvious answer of course is to add a cookie that remembers the state, in this case which month, it is at and check that on each page load. Now any search of the internet will give you all kinds of scripts and methods for doing such a thing, but in this instance, because we’re using JojoCMS, all the hard work is done for me.

A little known feature of Jojo is that not only does it have a great PHP framework but there is also a list of javascript functions that anyone can take advantage of, that are included in the jojo core. While most of these are really based around the CMS, the cookie based ones are really helpful. I’m talking about the following:

function setCookie(name, value, expires, path, domain, secure)

function getCookie(name)

function deleteCookie(name, path, domain)

Because these functions are in the jojo core functions.js file they are always available for any plugin or theme to use. Definitely saves a lot of coding and reduces the amount of duplicate javascript code.