Hyperframe flatfile CMS

Pages in Subdirectories

and issues met on larger sites with segregated content

The default Hyperframe installation expects all webpages to be in a single directory, the site root. This is probably the most convenient arrangement for small sites of up to, say, fifty pages, and is typical of most flatfile CMS packages. Hyperframe is however capable of supporting tree-structured sites. For larger sites it will be more convenient to segregate content into site sections, each section consisting of a subdirectory with its own html files and associated images.

The main change needed is to use an absolute filesystem path for references to codebase/hyperframe.php, the system loader, such that it can be loaded regardless of the page's location.

  • If your php subsystem is of the Apache module, this reference will be in .htaccess
  • If your php subsystem is of the CGI or FastCGI type, this reference will be in either php.ini or .user.ini 

Apache module mode:

In .htaccess, the line in question is:
  php_value auto_prepend_file codebase/hyperframe.php

and you need to prefix this with the filesystem root of your site. The filesystem root varies from host to host, but will be something like '/home/[username]/public_html/' You can generally find out what this value is from your host's documentation or online resources. So, you adjust this line to :
  php_value auto_prepend_file /home/widgetsinc/public_html/codebase/hyperframe.php

Since .htaccess directives apply to subdirectories there is no need to repeat this elsewhere.

CGI mode:

Here the setting is in a php.ini or .user.ini file in the root of the website. (note the dot before .user.ini, this is not a typo)

Which of the two will apply is sometimes hard to determine, and the best answer here is to consult your host's documentation. You can in fact have both, as the redundant file will will not cause any errors.

The main difference between them is that php.ini does not apply to subdirectories, so on servers controlled by a php.ini config, you need to place a copy of your php.ini inside all directories containing html pages.

.user.ini applies to the current level and all sublevels so you only need one declaration in the site root. Conversely, you will need a .user.ini cancelling the prepend in any subdirectories where you do not wish the CMS to process content.

For example, if your site root is '/home/widgetsinc/public_html/' then the line to activate the CMS might read:

auto_prepend_file = '/home/widgetsinc/public_html/codebase/hyperframe.php'

The cancellation command reads: auto_prepend_file = 'none'

BTW if the system cannot find hyperframe.php, it will let you know about this, in no uncertain terms. In that case, you need to check that you have given the right location.

We are looking at writing an installer to automate this task, however there are difficulties with determining which architecture exists on any given webhost.

Good Practices

In sites with subdirectories, it is always best to refer to images and links by way of a relative path. If you use absolute paths, you will create a 'nailed-down' website which cannot be moved to another directory. This is not generally an issue when linking to content in the same or lower directory, but issues may arise when linking upward in the path, or across to other branches. In that case, check your link syntax carefully.