To get Best Friend Forever access, register (it's free) or login below:

Dynamic gig listings

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 to by Brad on 8/21/06 @ 9:56 am |
« Hip hop rivalries | Making Me Nervous in REAPER »




12 Responses to “Dynamic gig listings”



  1. 1
    marcus

    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.

  2. 2
    Bill Dickerson

    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

  3. 3
    scottandrew

    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.

  4. 4
    Eric

    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.

  5. 5
    jason

    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.

  6. 6
    Eric

    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.

  7. 7
    jason

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

  8. 8
    Richard

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

    Did you ever put it up somewhere?

    Regards
    Richard!

  9. 9
    DUG

    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.

  10. 10
    dave

    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?

  11. 11
    Itsik

    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

  12. 12
    John

    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.



Leave a Reply

my other sites: in4mador!, stripcreator