Best Friend Forever Login

To participate, register for Best Friend Forever access or login below:

Latest Release

Brad Sucks: Guess Who's a Mess album cover

Guess Who's a Mess, my third album. 10 tracks, instant downloads.

Not into albums?

 

Email Signup

Get the latest Brad Sucks updates:

Upcoming Shows

Blog

I finally got fed up with updating gig listings in multiple locations so I did a little php voodoo last night to run all three listings (my front page, live page and MySpace) out of one file.

First I made a data file with all our gigs: giglist.txt.

Then I wrote a php script to parse that file and display the html data in the two different formats I need for my site:

front page format

live page format

Then I stole and hacked up this great tutorial by Bill Dickerson: How to Generate Dynamic HostBaby Calendars on MySpace that Scott sent me, to generate the third format, a dynamically generated jpeg image:

All I did really was skip all the Hostbaby specific stuff and then had to fix the object constructor and destructor to work with PHP 4 as there’s no PHP 5 on this boat.

I’d like to add RSS or iCal feeds though I have a suspicion that’d be a lot of work and then nobody would use them. Anyway, if you want the source for any of this, just let me know.

Posted on - August 21, 2006 [at] 9:56 am by Brad
Tagged in -

12 Comments on this post

marcus on Dynamic gig listings
August 21, 2006 at 10:30 am

I thought “ON” was from the text file, and you could change it to OFF if a show got cancelled, but then I realized it’s short for Ontario.

Bill Dickerson on Dynamic gig listings
August 21, 2006 at 1:31 pm

Brad,

Glad to know that my code/work is being used by others with success. This was a first rough draft at JpgPage, and I really should give it some proper OO re-working (remove the calendar stuff, and create an inherited class with that stuff, etc.).

— Bill Dickerson

scottandrew on Dynamic gig listings
August 21, 2006 at 4:37 pm

Gig DB + PHP + GDLib = coolosity.

If you wanna get crazy, you can use the same approach to generate graphic banners that update automatically. Pull the topmost upcoming gig and cram it into a photo.

Check the top-right graphic here:

http://www.myspace.com/scottandrewmusic

I never have to update that image, it’s all GD-powered.

Eric on Dynamic gig listings
August 21, 2006 at 9:31 pm

Not much use to you now, but it’s actually really simple to create dynamically updated PNG files with some built-in PHP functions using whatever source you know how to work with (text, RSS, MySQL database, etc.). You can make your own free and custom “Scrobbler Sig” with Last.fm data which they give out for free and a whole lot of other neat stuff. If you decide to hop on the last.fm bandwagon, there’d probably be some neat things you could build with the Brad Sucks-specific data you’d get for free.

jason on Dynamic gig listings
August 22, 2006 at 8:08 am

Eric… can you point to any code or examples or whatnot on PNG generation in PHP? I’d love to get my grubby hands on code like that and play around.

Eric on Dynamic gig listings
August 22, 2006 at 3:11 pm

As long as you have the GD library (found here: http://www.boutell.com/gd/ if your version of PHP didn’t come bundled with it to begin with), you can use a whole slew of functions found here: http://us3.php.net/gd

I haven’t found a good tutorial or anything for it online, but here would be a basic image of a black rectangle one white background:

There might some examples on the PHP website. If you’re like me and just want to run straight into it, arms swinging, here’s a script straight off of the AudioScrobbler wiki: http://timothyhumphrey.name/scrobblersig/scrobblersig.zip Get and clean that, and you’ve got basically everything you’d ever want. Hope that helps.

jason on Dynamic gig listings
August 23, 2006 at 1:17 pm

Cool. Thanks! I’m wanting to play aroudn with afew ideas and this will be perfect for it.

Richard on Dynamic gig listings
September 12, 2006 at 9:46 am

hey!
That’s a nice one! exactly what I need!

Did you ever put it up somewhere?

Regards
Richard!

DUG on Dynamic gig listings
December 2, 2006 at 12:55 am

Hey If I don’t know PHP am I screwed? I want to add a live updatable gig list to my friends band site. Is there and easy fix. I can stumble through html and flash.

dave on Dynamic gig listings
July 12, 2007 at 11:24 pm

Brad,

I found your page via a Google search for “JpgPage class”

I would love to see source code that you worked up for this.

Can you email it to me?

Itsik on Dynamic gig listings
October 16, 2007 at 8:12 am

Hi Brad.

Loved the simple and elegant way you made the gig listing thing.
Could you please email me the source code for it?

thnx in advance
Itsik

John on Dynamic gig listings
September 18, 2008 at 9:46 pm

I would also love the source code if you could. I’ve been looking for a simple way to do basically the same thing. Thanks.

Comments are closed on this post.