As I am starting my own business I am building a new site (www.detora.nl). My hosting provider provides a web site with static files, PHP and MySQL. The last two are not my cup of tea, so I decided to create a site with static HTML files for a start. I took my ASCII editor and set out to create the files. A large part of the pages show more or less then same on every page. Do I have to copy this theme on each page? How do I cope with changes in the design, that cann’t be implemented in CSS?

There must be tools available for this. But I am not in to Dream Weaver, Frontpage and I don’t want to invest time in a new tool if I don’t have to. So I decide to use Application Express to build the site. And it works!

I have implemented the basic theme in a page template. Most of the site is formatted using CSS so I have created a very basic templates for a Region (just showing a title and the HTML content) and some list template for the various menus througout the site. The general menus are placed on page zero.

This way I had my site up and running quite fast. There is only one problem. It’s run in Application Express and it should be static files. This can be solved by saving the webpages to files (use Show source and save the content of that!) and changing the links. Normally a Apex link has the format f?p=&APP_ID.:200:&APP_SESSION.. This is not very useful, because you cannot extract anything like a filename from this. So the links I created use application and page aliases resulting in a link like f?p=detora:about_detora:&APP_SESSION.. If you clip the part around the page alias and augment it with .html you have a perfectly usable link! Make sure you save the pages under there page alias name!

Off course this work is tedious and error prone, so I would not be an IT professional if I would not set out to automate this. It must be possible to write a PL/SQL procedure that reads the pages from the Apex dictionary, accesses each page through UTL_HTTP, replaces the links and writes the static file for the page. To be continued…

One nice thing about using Apex is the possibility to show objects conditionally. I use this feature more and more. It can be used for example to show an “under construction” image on pages that have not been filled yet:

  • create a region on page 0 containing a nice “Under construction” image
  • put a condition on it of type “NOT exists (SQL query returns no rows)”
  • add a query to this condition that returns the regions of the current page:

select p.name, r.plug_name
from flows_020200.wwv_flow_page_plugs r
, flows_020200.wwv_flow_steps p
where p.flow_id = &APP_ID.
and r.flow_id = &APP_ID.
and p.id = r.page_id
and p.id = &APP_PAGE_ID.

In this way the “under construction” region will only be shown on a page that does not have any regions.Just make sure you create empty pages for all the links on the site!

Have fun creating your own site with Apex.

Source Article from http://dickdral.blogspot.com/2008/06/pages-under-construction.html

Leave a Reply