Saturday, August 25, 2012

PHP Parse error: syntax error, unexpected '=' in

I recently get the following error in PHP:

Parse error: syntax error, unexpected '=' in .... line 109

apparently it is because I created a variable with "-" in it.

To resolve the issue, I rename the variable from "$cart-content" to "$cart_content"

PHP iterating all cookies

To iterate all of the cookies that have been set in PHP:

foreach ($_COOKIE as $cookie_name => $cookie_value)
{
 echo "$cookie_name with value $cookie_value";
 }

JQUERY Cookie TypeError

Error:

TypeError: Object function (a,b){return new p.fn.init(a,b,c)} has no method 'cookie'

The error is simply because, the jquery cookie file has not been added.

 To add just download the jquery.cookie.js at github

 Then add the jquery.cookie.js

<script src="./jquery.cookie.js"></script>

No horizontal scroll bar in Firefox

Firefox seems to have a bug in displaying the horizontal scrollbar for a certain CSS. To force it to display scrollbar when needed just use this css
html {
  overflow-x: auto;
}