Monday, February 27, 2012

Drupal - Bootstrap for old PHP script

In a hurry and I have an old PHP application that pulls data from proprietary tables.  I have connected some of the data to a node, but now I need to display the data in a separate window when applicable.

So, using the old and large PHP script, just to get it functioning, I had to bootstrap Drupal.
Place this at the beginning of OldLarge.php


$drupal_dir = getenv("DOCUMENT_ROOT");
$current_directory = getcwd();
chdir($drupal_dir);


require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

...
Do my Drupal stuff here....db_query() and whatever so that I can get results back from weird tables.
...

Then at the end of  OldLarge.php , add the final code....


chdir($current_directory);


Eventually...some day (which ends up being never) I will convert the OldLarge.php script to something more Drupalized.

Wednesday, February 8, 2012

CiviCRM "Javascript must be enabled in your browser in order to use the dashboard features"

"Javascript must be enabled in your browser in order to use the dashboard features"

I started getting this error from some of my testers when they were using IE9.  Sure enough, I couldn't access the CiviCRM dashboard or CiviCRM menu (it acted like it was disabled).

Yep, well JavaScript is enabled.

Stats on the site:
CiviCRM version 3.4.8
Latest Drupal (6.24)
Drupal module jquery_update installed (giving Drupal the jQuery version 1.3.2)

Hmmmmmm.....It works FINE with Chrome (16.0.912.77 m), Opera (11.61), Safari (5.1.2), and Firefox (10).

Oh YEAH!  That's right!!!   Internet Explorer doesn't handle a lot of JavaScript files very well.  CSS files are limited to 32(?) I think.  Not sure what the JS limit is.

So on the TEST site I enabled "Optimize JavaScript files" and all works well in IE8/IE9.

Things to look at:
http://drupal.org/project/javascript_aggregator
Great article by Vlad http://shvetsgroup.com/blog/optimizing-javascript-and-css-files-drupal