Geeklog Documentation

Static Pages plugin 1.4

What is it?

The Static Pages plugin was originally aimed at creating pages with static content (as opposed to the dynamic pages created by Geeklog) - hence the name. Pages like an "about us" page, a mission statement, etc. would come to mind.

Since then, people have used the static pages for all kinds of things and with the inclusion of PHP into static pages, even the original name isn't quite right any more ...


The plugin was originally written by Tony Bibbs and is included with Geeklog as a pre-installed plugin since Geeklog 1.3.5. An extended version of the plugin was started by Phill Gillespie and later supported by Tom Willet. The extended version was the first to allow the use of PHP in static pages and also supported proper Geeklog permissions.

With Geeklog 1.3.8 and Static Pages 1.3, these two versions were merged again. Static Pages 1.3 also introduced some new features that were not included in either of its predecessors.


Use of PHP

Activating PHP

Important: For security reasons, the use of PHP in static pages is disabled by default. To enable it, you will have to grant the 'staticpages.PHP' permission to the "Static Page Admin" group. To do this, log in as the Admin and from the Admin's Only block, select "Groups". Find the "Static Page Admin" group and edit it by clicking on the name of the group. At the bottom of the page, you will find a list of "Rights" (permissions) that can be granted to all members of this group. Note that 'staticpages.delete' and 'staticpages.edit' are checked, while 'staticpages.PHP' is not checked. To allow members of the Static Page Admin group to use PHP in static pages, you will have to check the 'staticpages.PHP' checkbox and save your changes.

In addition to the 'staticpages.PHP' permission discussed above, there is also a global flag, $_SP_CONF['allow_php'], that can be used to disable the use of PHP in static pages entirely. When set to 0, it will override the 'staticpages.PHP' permission and disable all use of PHP in static pages. The flag is located in the static pages' config.php file in the plugins/staticpages directory.


The use of PHP in static pages may result in security issues if not used properly. Use this feature with care!

The use of PHP has to be enabled for each individual static page. Below the content edit field, you will find a drop-down menu with the following options:

Please note that when embedding PHP code in a static page, your code should not be enclosed in the PHP <?php and ?> tags. Instead, it is assumed that the static page contains the PHP code that would normally go between those two tags.

When selecting the second of the above PHP execution options ("execute PHP") you can, however, switch back and forth between PHP and plain HTML like this:

echo "Hello"; ?>, <b>world</b>, <?php echo "how are you?";

The above example would print out "Hello, world, how are you?".

Page ID

When creating a new static page, it will be assigned a page ID automatically. This ID consists of the date and time and up to three random digits. When you anticipate that the URL of this page may be used a lot, e.g. quoted in emails, it may make sense to use a more readable ID for the page.

The static pages editor will let you change the page ID. For example, you may want to rename the ID for your "about" page from "20030313100131123" to "about", thus creating a URL like


which looks much nicer when quoted (and is easier to remember). You could further improve this by making use of Geeklog's URL rewrite feature.

Please note that you should only use letters and digits for the page ID. Avoid national special characters, most punctuation characters ('-' and '.' should be okay, though) and spaces. The static page editor will catch some illegal characters but not all of them ...

Using Static Pages on the index page

Geeklog 1.3.8 introduced a new concept for use by plugins, called Center Blocks. Basically, this means that any plugin can place blocks in the center area of a Geeklog site, i.e. among the stories.

When you check the "Centerblock" option for a static page, you can use the "Position" and "Topic" drop-downs to chose where this static page will be displayed. For "Position", the options are "Top Of Page", "After Featured Story", "Bottom Of Page" (which should be self-explanatory) and "Entire Page". That last option, "Entire Page", will tell Geeklog that this static page will replace the entire index page - it will not display any stories, but only the contents of this static page. This is useful e.g. for "splash" screens or Welcome pages.

Tip: When using a static page as a "splash" screen, you may need a link that takes your visitors to the normal index page, i.e. the list of current stories. To do this, create a link to index.php?display=all

The second drop-down, "Topic", lets you restrict the display of a static page to only a certain topic, the homepage only, or all pages (i.e. all topic pages and the homepage). This is the same as the options you have for blocks.

Tip: You can combine these options with the permission settings. This will let you, for example, create a "welcome" page that is only displayed to anonymous users.


When you have more than one static page that would appear in the same section of the center area (e.g. two static pages that would be displayed at the top of the index page), you can chose the order in which they appear by setting the $_SP_CONF['sort_by'] variable in the plugin's config.php file to one of id (sort by page id), date (sort by last changed date), or title (sort by page title). The default is to sort by page id.

Wrapping Static Pages in a block

You can chose to have a static page wrapped in a Geeklog block by checking the "wrap static page in a block" option in the static pages editor. If selected, the page's title will be used as the block title.

The plugin's config.php file also has a flag, $_SP_CONF['in_block'], which is used as the default for this option.

Cloning Static Pages

When you have a lot of similar static pages you may want to make a copy of an existing page and then edit that copy. This can easily be done by clicking on the [C] from the list of static pages. Doing so will create a copy of that page with a new page ID.

URL rewriting

Please note that this feature is considered experimental and is known not to work with IIS.

Geeklog supports a form of URL rewriting, i.e. change the look of URLs such that they are more search engine friendly. For example, instead of


the URL could look like this


Some search engines are known not to index pages when the URL includes characters like '?' and '='. You could further improve the chances of this page being indexed by replacing the numeric page ID with a word or expression (preferrably something that corresponds to the page's content), e.g.


To make use of URL rewriting, you will need to enable it in Geeklog's config.php file by setting

$_CONF['url_rewrite'] = true;

The Static Pages plugin is currently the only plugin known to make use of this feature.

Deleting pages with their owner

As all objects in Geeklog, static pages have an owner (the user that created the static page). When that user's account is deleted for some reason, any static pages owned by that user can either be deleted as well or they can be assigned to another user in Geeklog's Root group. The config.php file for the Static Pages plugin has the following option:

$_SP_CONF['delete_pages'] = 0;

If set to 0 (which is the default), static pages will not be deleted with their owner, but assigned to a member of the Root group instead (the user with the lowest user ID, most likely the Admin). If you change this to 1, static pages will be deleted when their owner's account is deleted.