Awesome

March 3, 2006 on 1:25 pm | In Computing |

Somewhat technical blog coming up, so if you’re bound not to understand any of it (Martin?) then consider yourself warned. ;)

My scripts page is hardly a day old and already I’ve rewritten it entirely. On the outside, it looks just about the same, but internally, everything is different.
Originally, the pages were just static HTML pages. Now, however, I’m using PHP with XML, which is something I had not done before, apart from the RSS2PNG script.

It’s nothing too revolutionary, but I’m still quite proud of it, because it’s an interesting example of how much my knowledge of PHP has increased over the past 5 days. Maybe I’ll even add one of those ’show source’ links to the script just so my ego can grow a bit more.

So, on to the details. The script makes an index of all the available scripts by looking in every directory in the scripts folder, and checking if there’s a script.xml file inside. If there is, it opens the xml file, takes some of the basic information such as the script’s name and short description, and places it in an array.

Then, when it has placed all the scripts into the array, it just dumps that to the page, in a pretty way.
When you go to the page of a specific script, it also reads the xml file, and just writes all the other information to the screen.
For example, check out the RSS2PNG XML file.

Then I also wrote a little RewriteRule which ended up being a pain in the ass. The RewriteRule makes it possible to go to http://www.gonewacko.com/scripts/rss2png, even though it will technically go to http://www.gonewacko.com/scripts/index.php?script=rss2png.

To do this, I used the following rewrite rule:
RewriteRule ^(\w+)$ index.php?script=$1 [L]
However, this somehow did work on my localhost (Apache 2.2), but it didn’t work on gonewacko.com (Apache 1.3), even though mod_rewrite doesn’t appear to have changed that much at all.
In the end I found out that \w wasn’t working for some strange inexplicable reason, but after replacing it with it’s equivalent,
RewriteRule ^([a-zA-Z0-9_]+)$ index.php?script=$1 [L]
everything worked fine. That did take quite a long time to figure out though, probably because I was tired, because I found the solution shortly after waking up this morning :)

I’m currently planning on doing three things:

  • Adding a download counter to the scripts
  • Making it possible to write comments about the scripts
  • Adding smarty support so I can easily change the layout of the pages

And finally, a quote:

GoneWacko says: Read about it in my magazine, yes
Thomas says: you got your own magazine?
Thomas says: :o
GoneWacko says: yes
GoneWacko says: GoneWacko Weekly
GoneWacko says: There’s a new issue every month

13 Comments »

RSS feed for comments on this post. TrackBack URI

  1. ‘…my ego can grow a bit more.’

    Is that possible? :P

    Comment by Martin — March 3, 2006 #

  2. That’s not funny. AIDS is more fun than that.

    Comment by Kopa — March 3, 2006 #

  3. If that’s supposed to be in reference to my comment, you know what you can do…

    Comment by Martin — March 3, 2006 #

  4. No, I was refering to the quote that GoneWacko posted.

    Comment by Kopa — March 4, 2006 #

  5. Oops, sorry! :)

    Comment by Martin — March 4, 2006 #

  6. Don’t be sorry, kopa is generally rude.
    I’m just used to it so I don’t feel offended ;)

    Comment by GoneWacko — March 4, 2006 #

  7. Heh… I liked it but I think you are forgetting about your big stick you could’ve used to beat the server….

    Comment by Andel — March 4, 2006 #

  8. Big stick? Sick.

    Comment by Kopa — March 4, 2006 #

  9. [02:01:34] <AMIAndel> or have u tried kicking it?
    [02:02:01] <@GoneWacko> well no, but that’s mainly because the server is in Amsterdam
    [02:02:06] <AMIAndel> ahhh
    [02:02:19] <AMIAndel> big stick, sir?
    [02:02:51] <@GoneWacko> that’d be impressive
    [02:02:56] <AMIAndel> lol
    [02:03:03] <AMIAndel> get u all the girls then ;)
    [02:03:33] <AMIAndel> they’d want to use u and ur stick to hit their computers with
    [02:03:37] <AMIAndel> you’d be a hero in their eyes
    [02:04:54] <@GoneWacko> That gives a whole new meaning to ‘I’d hit it’
    [02:05:08] <AMIAndel> lol it does, doesn’t it
    [02:05:17] <AMIAndel> but think of the fame and fortune, dear sir…
    [02:05:26] <AMIAndel> thats right - think AMERICAN!

    Comment by GoneWacko — March 4, 2006 #

  10. Must be a Dutch thing.

    Comment by Kopa — March 5, 2006 #

  11. I consider that quote funny … I mean, Weekly and a new Issue every month. I like it ; )

    And I think I should work on my pathetic php skills once more, because it seems to be quite handy and entertaining ^_°

    Comment by Medic — March 6, 2006 #

  12. hmmmmm - and I shamelessly sell myself huh? Well, maybe ‘cos my blog is also on various colleagues rss feeds too….

    Comment by Andel — March 8, 2006 #

  13. Well I don’t sell anything at this moment in time.

    Although, dear readers, I am for hire if you need any PHP scripts written.

    CALL ME!

    Comment by GoneWacko — March 8, 2006 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^