PHP, Plugins

Posted 2009.03.30 18.47 in Computers/Internet/Technology by Stephanie

So I’ve been working more on the dropdown menus and I’m about 98% satisfied with them. I ran into some areas where either “I wuz doin it wrong” or the plugin didn’t work as I thought it would/should. Basically there were three things that I had to fix/change. First, the menu sorting was not ideal; I wanted it to have two levels of sorting and it only did one. Second, it was supposed to highlight the page title you were on, and this didn’t work for pages in the 3rd level. And finally, if you were on a 1st or 2nd level page, it sometimes highlighted all the child-page titles as well, seemingly at random.

Now, my level of PHP experience is about here: I bought a book and have learned how to make minor changes to wordpress themes. Still, I’m not shy about diving in headfirst, and always keep a backup incase I royally screw things up. I’ve got a pretty successful track record of debugging / fixing / modifying software written in languages that I know nothing about. Anyway, it was not too terribly difficult to edit the php file and make it behave the way I wanted it to. Except for one crazy thing.

After messing around with it for an hour, testing, tinkering, testing, things appeared to be working. Then I tried to go into the admin area, and started getting all these error messages. Problems with headers and stuff. I assumed that at some point in my tinkering I had broken things, and although the site seemed to work, I’d busted the admin side. So more tinkering, some googling, and suchforth.

Eventually what I learned was that PHP is incredibly picky when it comes to whitespace at the top or bottom of the files. I normally leave some blank lines at the end for no particular reason when I’m editing in vi and it’s not a problem in html, css, or anything else. So I never would have guessed that a blank line at the end of a PHP file would cause so much devestation. Still, at least it was easy enough to fix, and considering that was the worst mistake I made, all in all it was a pretty successful expedition into PHP and plugins.

And – I got the functionality I wanted out of the dropdown thingy. So, yay me! 🙂

4 Comments

  1. Lezley says:

    Yay you and the drop-down menu!! Can I assume that you have deleted your ‘share this’ widget? Booo… share this encourages dissemination of your genius.

  2. Stephanie says:

    I haven’t deleted share this, but have disabled it for now. I need to understand more about what these things all do.. when they do things that I don’t understand, it concerns me. Like inserting scripts into the header, scripts that are hosted elsewhere that I have no control over. Not saying it’s dangerous, just that until I understand it more, I am being cautious.

  3. Lezley says:

    Why do I have a weird backgammon-board icon? Can I get a cool icon… like an onion (ha!!).

  4. Stephanie says:

    The default icons (avatars) are randomly generated. If you want a cool custom one like mine, sign-up at http://en.gravatar.com/ where you can load your own avatar. It will then follow you to any other blog or site that is Gravatar-enabled, so you have the same ‘identity’ wherever you go.

Leave a Comment