So, I spent most of today working on a website for a side-project at work. I didn't know anything about the server, besides the fact that I had an ftp account, so a good half-hour was spent this morning figuring out if it does Perl or PHP, if I could SSH or telnet or anything like that. (Though for some reason I didn't check ASP - and doing it just now, it doesn't seem to support it.)
Anyway, ends up that it does both PHP and Perl. Perl is the first scripting language I ever used seriously - this is what we used to write our online registration system for our career fair back in college, our web calendar, and some other things like that. Most of the stuff I do these days in in ASP classic (VBScript). I was thinking since all I was doing was coming up with a simple online registration, I'd learn some rudimentary PHP, and diversify my skills a bit more. So, after I spent some time on the design side and some other random tasks, I got into writing the registration form. The syntax is very similar to Perl, which made things easy.
Everything is fine until I get stuck trying to figure out PHP includes
. I use lots of SSI includes for headers/footers/menus/etc, but unlike ASP, you can't have both SSI and code, as the PHP interpreter won't process the SSI. So, apparently this is much more difficult though since the PHP include() only takes relative paths. Of course, I miss this when I'm reading the documentation, so I spend quite a bit of time trying to get this to work. Now, apparently there are plenty of hacks out there that people have written, that reset the include_path dependent upon where you are relative to your web root, but it seems silly to me that you would need all these functions to do something as simple as include a file. Also, for some reason, php.net thinks my localization is German, so the documentation is all in German. I haven't figured out how to fix that yet . . .
I ended up just hard coding in the path (something like ../../../includes/) to get all the way back to where I had put the includes. How silly.