Options

smlatest.pl - hack to set featured gallery -> 4 last updated galleries

darryldarryl Registered Users Posts: 997 Major grins
STOP! THIS HACK IS NO LONGER NECESSARY. You should use [post=688574]this hack[/post] instead, which uses Javascript hackery to dynamically replace your Featured Galleries with the last X (you can have more than 4!) galleries updated (per your RSS feed). Unless of course you think Javascript hacks are nasty. In which case, feel free to continue to use this hack. :-}
Hiya: I hacked together a Perl script w/ LWP and XML::Simple to grab a list of all the galleries, sort them in reverse chronological order, and then sets the 4 most recent ones to be your featured galleries.

That last bit isn't through the API, because the API doesn't support it. Instead, I use LWP to login on my behalf, and then using that cookie, fire off the HTTP POST command used to set a featured gallery.

It's pretty slow, so I just have a cron job set to run it nightly.

Feel free to have a gander:

http://www.darryl.com/smlatest/

After [thread=73556]finding out[/thread] how to set the title of "featured galleries" to "last updated galleries", I realized that *maybe* there's a way to do this with JavaScript? I was thinking that even if you're listing galleries by Category, perhaps the gallery of all galleries, sorted by last updated, might still be accessible using JavaScript magic?

And maybe you could just display just the top 4 galleries? Or heck, any number if you had them all. I guess I'm envisioning a bit of JS like [thread=49658]this niftyness[/thread].

Well, I don't know enough JavaScript, but since others have asked for a [thread=23945]"last updated galleries" feature[/thread] before, it'd be nifty of somebody else coded it. :-}

--Darryl

Comments

  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited October 14, 2007
    In retrospect, the figuring out which galleries are most recent is probably much more easily accomplished by hitting the RSS feed. GAH!

    --Darryl
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited October 14, 2007
    I'm an idiot. So now the script uses RSS, and only updates Featured Galleries with the latest four if they've actually changed. Hooray.

    Added bonus (?) -- no API calls needed and it's tons faster.
Sign In or Register to comment.