Posts Tagged ‘PHP’

Dru­pal has a Tax­on­omy mod­ule for cat­e­go­riz­ing con­tent. The mod­ule can gen­er­ate a select box based on the defined tax­on­omy. How­ever, it does not sup­port option groups. I fig­ured I’d share my mod­i­fi­ca­tion for those who’d like to do the same. It was based on code from a Dru­pal forum post which I think was based on Dru­pal 5, not 6.


On Ubuntu 8.10, I ran into a bit of prob­lem. The Apache web server was work­ing fine, but the fol­low­ing commands:

sudo apt-get install php5 libapache-mod-php5
sudo /etc/init.d/apache2 restart

failed to work after cre­at­ing a phpinfo.php file in the /var/www/ root folder. Fire­fox com­plained, “You have cho­sen to open phpinfo.php which is a: PHP file.” Apache was not using the PHP pre­proces­sor for some rea­son. A bunch of forum posts and blogs said to edit either /etc/apache2/httpd.conf or /etc/apache2/apache2.conf in order to asso­ciate the PHP mime type with the file exten­sion. That wouldn’t work because I had also installed php­myad­min which has an apache.conf file that already has an AddType direc­tive. So, after some dig­ging around, it turns out the mod­ule wasn’t even being loaded, even though that’s what you’d expect the pack­age man­ager to han­dle when you tell it to install the mod­ule. Any how, to fix the prob­lem, just cre­ate sym­bolic links to the php5.load and php5.conf files in the /etc/apache2/mods-enabled/ folder.

sudo ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load
sudo ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
sudo /etc/init.d/apache2 restart

Update: Debian-based installs of Apache2 have some handy com­mand line utils for man­ag­ing the web server. So to enable a mod, which auto­mates the above, do this instead:

sudo a2enmod php5

a2dismod is the com­mand for dis­abling a mod. For sites, there is also a2ensite and a2dissite.

As a few users of MyGoogleCal3 have already pointed out, the script no longer works prop­erly. That’s the bad news. The good news is ver­sion 4 does work. In fact, with the lat­est changes Google made to their code, ALL the fea­tures that were bro­ken in 3 appear to be work­ing now—Agenda/Week view, the cal­en­dar nav­i­ga­tion but­tons, and IE is fixed. Please down­load and test out the lat­est ver­sion, and report any bugs in the com­ments and I’ll try to resolve them as time allows.


MyGoogleCal2 no longer works 100% in Inter­net Explorer. A run­time error occurs when nav­i­gat­ing month-to-month or when switch­ing to Agenda mode. The workaround is to sim­ply hide the nav­i­ga­tion inter­face. Now, I don’t know if this bug was intro­duced when Google updated the code last month, or if it’s always been there and I just never noticed. In any case, the run­time error occurs when //""/calendar is replaced by // Given the poor debug­ging avail­able in IE, I didn’t get very far with fig­ur­ing out why IE breaks. I sus­pect that when IE makes an Xml­HttpRe­quest, it’s dou­ble check­ing that the request URL matches up with the server host, or some­thing to that effect. Since Google obfus­cates the Javascript code, it’s just way too hard to try and fix it. Instead, I’ve opted to cre­ate a new ver­sion of MyGoogle­Cal that uses the orig­i­nal tech­nique for IE but uses the tech­nique from MyGoogleCal2 for all other browsers.