« Confessions of a Dangerous Mind | Main | Commericals and Movies »

February 23, 2003

Hacking Gallery code

After my little tirade about the state of affairs on my web-page, I became motivated to make things look better. Thanks to the magic of CSS I now have a rather consistent looking home page system. How odd and terribly frightening.

The big problem seems to be getting Gallery to work with it. They've done a great job on creating a PHP based system for displaying graphics, but it's not very extensible right now. The html_wrap directory only allows you to edit the headers and footers essentially of the system. So I hacked the code a bunch. This will most assuredly make it a headache to upgrade in the future, so read on only if you like headaches.

I wanted to use the same CSS file in all my pages, as such the util.php file contains the path/directory information for the gallery based CSS in a function better known as _getStyleSheetLink(). Note the leading underscore. Altering this to always return my common CSS file works for me. I don't plan on embedding this, so I really didn't care about many of it's options and just cleared them out.

One of the things about Gallery that really annoys me is the system for de-marking an album. I figured the text "album" was enough and absolutely despise the fake "many pictures" graphic they use. This was easy to remove, and cuts down on the downloading of at least 3 misc graphics from my web-server. In the html_wrap directory there is a file inline_gallerythumb.frame.default. Make this just inline_gallerythumb.frame and inside of the file the last 3 entries for the table can be removed safely. No more annoying layered picture image. You'll need to do this same thing for inline_albumthumb.frame as well, if you want to completely get rid of all occurrences.

Next to make the initial Gallery page text look familiar to the rest of the site I had to alter the album.php file. If you scan through it for the word "Cell" you should find a comment that says something like "begin Text Cell". You can edit that section to alter any of the text that appears on the main page. Why this isn't in the html_wrap I'm not sure.

I wanted to alter the album views of images, but when I did I didn't like the output. In the essence of full disclosure though, you can alter these in the view_album.php file. Searching for the word "Viewed" helps to find the appropriate section to edit.

The end result of all this is the entire site is based off of CSS. I'm now starting to realize why Marko has a tag on his page that says "Friends don't let friends used table-based layouts". Once you can get into the whole CSS thing it is a lot easier to work with and makes a helluva lot more sense.

The bad part about it is that older browsers are not CSS compliant. By older I mean browsers from the Netscape 4 timeframe. One thought on this end: if you're still using such an old browser it's time to upgrade. Give it up, that piece of non-standards compliant bloatware isn't going to go anywhere useful. Not saying that Mozilla doesn't have a lot of bloat, but there are things like Opera and Mozilla spinoffs that aren't so bad. More importnatly thought they support current web standards.

The really really nice part about all of this hacking... if I decide I'd like to change the color scheme or what not, I just have to edit the CSS file. I was playing around with this and it was really quite fun. Maybe I'll make the web page skin-able.... naw...

Posted by Dan at February 23, 2003 07:35 AM

Comments