Tuesday, July 26, 2011

Pass PHP variables to Javascript in Drupal 6

 To access  PHP values and variables from JavaScript or convert php variables to JavaScript variables using Drupal 6, you can send them to your JavaScript code using Drupal's drupal_add_js function as follows:
drupal_to_js - Converts a PHP variable into its Javascript equivalent.
 example -
$msg= 'hello dear';    //passing php variables to javascript

 drupal_add_js("var apath = " . drupal_to_js($apath) . ";", 'inline');


Monday, July 4, 2011

CSS Variables

@variables {
CorporateLogoBGColor: #fe8d12;

div.logoContainer {
background-color: var(CorporateLogoBGColor);