on PHP includes();
i love PHP includes. they’re a big reason why i even use PHP. i was just collaborating on a project that used Dreamweaver templates, which I had never used before. they’re pretty handy, in their way: i was able to modify a template file and have the changes automatically registered in all the files based off the template (e.g.: i added some javascript to the template, and all the pages were updated with the same javascript while maintaining their individual content). where that gets really unfun, though (and where includes rock the snot off xhtml) is that i had to re-upload every single page in the site when i made changes like that. w/include, i just re-upload the included file.
anyway, i got to thinking about hierarchy with includes b/c a lot of the includes i used for the site were included in different folders and different levels of the site hierarchy. i have a tendancy to put navigation bars in includes for obvious reasons. this can get a little dicey when you move up and down the hierarchy though.
say i’ve got an include that has my navigation bar, with the first item being a link to the homepage:
<li><a href=”index.php”>Home</a></li>
include this in any file that’s in the root directory and i’m fine. but if i move it into another folder (like zbrustudios.com/pictures/) and it would need to be:
<li><a href=”../index.php”>Home</a></li>
when i’m dealing with large sites, i figured out that this gets all sorts of troublesome when lots of including is done. my simple work around?
in every page i declare a php variable for the depth. so at the root level:
$depth = “”;
in a folder (like zbrustudios.com/pictures/):
$depth = “../”;
and even deeper (zbrustudios.com/pictures/vacation/):
$depth = “../../”;
then in the navigation file that i include on each of these pages the link looks like this:
<li><a href=”<?=$depth;?>index.php”>Home</a></li>
voilà!
on Raining and Pouring
wow. it’s crunch time here for me. i’ve got a lot of stuff to finish up this week, and i just added two new clients to the list today. planning when things are pouring like this gets tricky, but i think i’m doing a pretty good job at it. i guess i have a lot of time to think while i wait for my computer to process things (working on an iBook G4, desperately waiting until the processor upgrades on the iMacs in January… don’t let me down, steve!).
i’d really like to take some time to update what i’ve been working on, and the little tricks that always seem to sprinkle out of big projects, but i think it will have to wait until i’m sipping silk nog and surrounded by bows.
on Sitemaps
i wasn’t really sure what i needed to do to create a sitemap with my WordPress account hosted on my server. there are so many ancillary folders and files, i wasn’t sure what needed to get indexed for search engines. i had used a php program to generate the sitemap for the rest of my site.
luckily, i found this great little WordPress plugin from Arne Brachhold. not only can it generate and update my sitemap as i publish new posts, it can also sit in my root folder and take care of the rest of my website, too. way to go, Arne!
on Names
z.bru studios. that’s it. i’ve even got a logo (after the break). way to go me! it was a tough, tough decision, but i’m happy with the results.
here’s a funny story, though. when i was checking domain names, i checked zbru.com in addition to zbrustudios.com. turns out someone w/a hotmail account (no offense intended to those still rocking hotmail) has zbru.com, and has a for-sale page posted at it. kind of curious but not that interested in paying for it, i emailed the hotmailer asking how much s/he was wanting for it. i figured maybe $100, and i’d only take it for $10 just for grins. guess they thought it was worth a bit more, b/c they asked for $4k. right.
maybe in the 90s that sort of thing would work out alright. maybe some existing company was a little late on the internet wagon, then realized their name space had already been bought up, and the entrepreneurial pirate could charge what they wanted. nowadays, though…. get serious. anyway w/an established business has for sure bought up there space (or they’re going out of business anyway), and anyone looking to start a business is going to be checking domain names while they’re thinking about business names and will obviously spare the $4k and think of a different name.
anyway, enough of my ranting. more than anything i just think it’s silly and antiquated. but no problem for me, for i’m the proud leaser of zbrustudios.com, home of the up and coming z.bru studios.
start looking for the z.bru….

on Forms
i’ve been working on some forms for a couple of different clients, and it never ceases to amaze me how much extra time i end up spending on them. i think i finally have my favorite system of validating w/both javascript and php. but i’m sure that will change. one of the clients was easier to do in some ways because they only deal with local clients. the other is international, so i had to think about country codes in phone numbers and find a list of every country. in some ways that was easier, though, because validation goes out the window; there are different phone number lengths, some countries don’t have zip codes, and with a chance of javascript being disabled, there’s no pretty way of listing different states in different countries. i’m feeling like someday, since we all deal with forms, form validation/entry will be taken care of by the browser, and the code will just tell the browser what info is wanted (‘address’ instead of ’street address’, ’state’, ‘zip’, etc.). api’s and cms’ are okay for some things, but for a quick and dirty form, it would be nice to have smarter browsers. what a pipe dream though. or maybe a pipe nightmare; i can just imagine having to hack the heck out of css to have the browser ‘form’ not explode a site.
on PHP and XML.
i’ve been working on a page for a client to have Amazon Associates and iTunes Affiliates links for a number of playlists (each w/100+ songs). i wish there were a pretty way of generating the links directly from the iTunes library file, but alas, i’ve spent many an hour watching tv and looking up the pertinent information for each song, and building XML pages using some crazy equations in Excel.
there are many things to watch out for when creating XML files, and many as well when parsing an XML file with PHP. one that i’m getting more and more familiar with is special characters. the ampersand character was one that really gave me pains. the iTunes data had the character &, but XML uses &. to complicate things further, while PHP is parsing XML nodes, if it comes across the ampersand character it splits the data up. for example, i had a tag as follows:
<artist>Huey Lewis & The News</artist>
on the user end, PHP was only spewing “The News”. i couldn’t figure out a buen solution, try as i might to replace characters while the PHP was building the arrays. today i came across this post:
xml_parse() and php and ampersands.
thank goodness for that! turns out i can concatenate the parts into a lovely whole. check the link for a better explanation, but this is my example:
before:
case $xml_artist_key:
$song_array[$counter]->artist = $data;
break;
after:
case $xml_artist_key:
$song_array[$counter]->artist .= $data;
break;
voila!
on Decisions.
i’m trying to decide on a name. what do i want people to see/hear/think when they come to my site? what’s that first impression? how much do i let them see? in relationships i’m usually slow at letting it all show; i want to know the angle the other person is coming from first. with this, though, i’ve got to give first without knowing what the reciever is interested in. choices always feel like a narrowing to me; yes, i’m getting something, but there are a number of things i’m trimming out. will what i choose for a name eliminate some potentially fun projects for me? what would bring me the projects i want? what projects do i want? a decision is floating my way, i know. for now i’m waiting.
