Monday, February 19th, 2007


Internet Explorer has some interesting foibles. And by interesting, I mean annoying.

For instance, if I’ve visited a page on my site, such as:

http://schinckel.blogsome.com/wp-admin/

Internet Explorer seems to remember it as

http://schinckel.blogsome.com/wp-admin

Notice that the trailing slash is missing. Blogsome will report that “Page Does Not Exist”, or if it looks like a Post page, “No posts made”.

With access to the HTTP server, this would be easy to fix (just create a rule in the relevant place that allows for URLs of this form), but on Blogsome this is a bit harder. You need to be able to check the last character of the URL string, and if it isn’t a /, append one. This should work fairly well in all cases, since every reader visible URL ends in a /.

So how to do this? Getting the URL is easy: {$smarty.server.REQUEST_URI}. However, getting the last character is a bit more difficult. Or so it appears. But Smarty allows for accessing strings as an array, so {$smarty.server.REQUEST_URI[0]} will get the first character. To get the last is a therefore possible. {$smarty.server.REQUEST_URI[-1]} fails, so I’ll need to get the length of the string.

{$smarty.server.REQUEST_URI[$smarty.server.REQUEST_URI|count_characters ]}

also fails, but

{$smarty.server.REQUEST_URI[smarty.server.REQUEST_URI|count_characters ]}

works.

Now, we just need to test if this value is “/”, and if it isn’t, then reload the page with that added.

Which I can’t seem to figure out how to do with Smarty…

Of course, doing the same with JavaScript is a piece of cake:

if (document.URL[document.URL.length-1] != “/”)
    document.location = document.URL + ‘/’

View Comments (0)   RSS Feed for Comments on this Post

I’m teaching Stage 2 Information Technology Studies this year (it’s turning out to be a fair bit of work, but I’m quite enjoying it), and I have to come up with some project topics. The students have to do two projects, one on each of the Option Topics we will be studying. At this stage, I’m planning on Application Programming (using python, and some form of GUI), and Website Programming (HTML+JavaScript).

What I do need to do is think of some suitable project topics. Something that is challenging enough for Year 12, but not too difficult. I’ve got some ideas for Websites, as there is a bit more scope to do something cool. It’s a bit easier to implement cool stuff with a more limited level of skill in HTML than it is in an application program.

I also have to write some skills tasks, that assess each of these topics. I’ve got some good ideas here for the application programming one (give them the GUI code, and get them to make the backend, and for the other, give them some working application code, but as a series of functions, and get them to combine the functions into a full application).

I’d love to be in a situation where I could teach ObjC, since I do have a Mac computer room at school, but since I don’t know it that well myself, that might be a future task. I seriously wish anygui had taken off. But, even late in the game then, I wasn’t really keen on how the backend interface was turning out. I came across Dabo yesterday, and that looks cool, though.

View Comments (0)   RSS Feed for Comments on this Post

There’s a new show starting soon on SBS, Wilfred. After seeing the advertisements a couple of times, it looks really good. The premise is that a girl’s dog, the Wilfred of the title, loves his owner, but hates the boyfriend. He manages to sabotage just about everything about the relationship. Sound interesting? It’s a comedy, and did I mention that the dog(s) in the show are men in dog suits.

However, something I just read might turn me off it, before I’ve even seen it. Apparently, it’s by the same guys who created the despicable excuse for a comedy that is known as The Wedge. The only saving grace may be that SBS has picked it up, rather than one of the commercial stations (notably Channel 10?) Perhaps that will mean it is actually good.

</TV Snob Mode>

View Comments (2)   RSS Feed for Comments on this Post