As The Crow Flies

« Allowing Clarify... | Main | Fun with Linux (i... »
Tuesday Mar 13, 2007

Serving database driven pages using Clarify ClearExpress

In order for this to work, somehow the users needed to have access to the pages that ClearExpress would serve.  We thought about something utilizing ftp or remote file system mounts.  But we were concerned with security and also we were trying to enforce a standard page template on the users while also using a familar interface.  Finally i came up with a way to serve web pages from the database.  In addition we built a few forms for the users to
create and maintain the pages.  This accomplished our goals of keeping the network within our existing security scheme, while also allowing the users to edit the web pages via custom Clarify forms.  Those forms could also be customized to enforce page template patterns.  All in all, it worked out very well.  Here's a screen shot of the main form for building the web pages.



The url that would be used to call these pages is:

http://localhost/cgi-bin/clearexp_cgi/webform.htm?form_id=2000
Notice that in this case the url is not secured as is typical with ClearExpress implementations.  Also notice the single parameter "form_id", this is the key to pulling the desired page from the database.

The page flow goes like this:
  1. A request to webform.htm is made.  The parameter 'form_id' is key to the form to be returned.
  2. When the user submits the form (if there is a form at all), the form action calls webproc.htm.  This will call a ClearExpress function to perform a database insert.  One of the parameters of the form should be 'next_page'.  This is the URL that the user will be redirected to after form submission.
The main trick to making this work is that each html code chunk that is retrieved from the database needs to have the leading '<' and trailing '>' character stripped from it (if they are present).  Otherwise i don't recall any other gotchas.  We even serve javascript code via these mechanism.

The only drawback i can think of is that we lose the ClearExpress built in page caching, but in our case, this wasn't determined to be a problem.  i can also say that in this particular implementation, many more pages were served via this mechanism than via the traditional ClearExpress WebSupport context with no perceptible performance hit.

Here's the code.  Just an FYI, i refactored the code a bit but have not tested it:
  ceDbPages.zip

Comments:

good stuff

Posted by Betty on March 15, 2007 at 04:19 PM PDT #

Post a Comment:
  • HTML Syntax: Allowed