Tuesday 22 July 2008

htp and htf (or seeking a sprig of parsley)

I'm still wrestling in my mind, seeking out ways to deliver more than the bare bones of the functional spec that has been handed to me. My philosophy as a software developer is this: give the client what they have asked for - but make sure you also give it a little flourish, like the sprig of parsley that completes that Michellin-starred meal.

That sprig of parsley isn't going to be one big thing - I have neither the inspiration nor, at the moment, the expertise in Apex to do that - but hopefully I'll think up loads of little things that'll make my application a pleasure to use - or at least not a pain.

Today I decided to give my users the ability to bookmark pages in the app an add shortcuts to them on the homepage. (Yes, I know browsers natively possess the ability to bookmark pages: don't be a smartarse!) To implement this functionality I'd have to wander down paths I'd avoided till now: regions based on dynamic PL/SQL, the htp package and the htf package (which, I've got to admit, I'd never even heard of until today).

Basically, what I'm gonna have to do is write some javaScript to grab the contents of the address bar, write a package to parse it (in order to find if any parameters have been passed to the page), and save this info to a database table.

I'll then build a region containing PL/SQL to create a list (hello htp.listitem and htf.anchor - it's nice making your acquaintance) based on the contents of my table.

Easy-peasy when you know how.

Obviously at the start of the day I didn't have a clue how to do any of this, or even know if it was possible. Yes, I know I could have hit the forums and copied someone else's work, but I wanted to figure it out for myself. That's the only way I'm going to learn the intricasies of the Apex thing.

No comments: