Geeklog

Static Pages plugin

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 ...

Features

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 option to disable the use of PHP in static pages entirely. That option ("Allow PHP?") can be found in the Configuration admin panel for the static pages plugin. When set to "False", that option will override the 'staticpages.PHP ' permission and disable all use of PHP in static pages.

Usage

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

http://yoursite/staticpages/index.php?page=about

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 ...

Multi Language Support

The Staticpage plugin also supports multiple languages (same as articles, blocks and topics). This means you can have a staticpage with the same id but a different language encoded into it. For example when multiple languages is enabled (see the following language config settings for more information) staticpage ids like "exampleid_en" refers to the English version of the staticpage "exampleid". The page "exampleid_ja" refers to the Japanese version. If both pages exist and depending on what language the visitor is using the appropriate page will be displayed. For more information on how this works you can also read Geeklog's Multi-Lanaguage Wiki support page.

Using Static Pages on the index page

Geeklog's Center Blocks concept allows plugins to 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.

Sorting

Centerblocks: 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 choose the order in which they appear from the Configuration admin panel for the static pages plugin. Your options are:

Please note that this order will only apply to centerblocks from static pages. All other plugins creating centerblocks will not be in that order. Also note that the centerblock is not necessarily looking like a standard Geeklog block. To achieve that, please check the field "Wrapping Static Pages in a block" below.

Menu entries: It's also possible to sort the static pages that are displayed in the site's menu (if you're using a theme that uses the {plg_menu_elements} variables in its header.thtml). This sort order can also be changed in the Configuration admin panel for the static pages plugin:

Wrapping Static Pages in a block

You can chose to have a static page wrapped in a Geeklog block-layout 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. Further, you can, as with normal blocks, enter a help URL. If this URL is entered, the block will display a help icon linking to that URL.

The default for this option can be set in the Configuration admin panel for the static pages plugin.

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

http://yoursite/staticpages/index.php?page=20030313100131123

the URL could look like this

http://yoursite/staticpages/index.php/20030313100131123

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.

http://yoursite/staticpages/index.php/about

To make use of URL rewriting, you will need to set the option "Enable URL Rewriting" to True in Geeklog's Configuration admin panel.

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.

In the Configuration admin panel for the static pages plugin, you can set the "Delete Pages with Owner?" option to either "False" (which is also the default), meaning that 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). Setting the option to "True" means that static pages will be deleted when their owner's account is deleted.

Template Static Pages

As of Geeklog 1.7.1, you now have the ability for a Static Page to use another Static Page as a template. What this allows you to do is create one template page and then have it be used by one or more other Static Pages as a base. This feature is ideal for people who have a number of similar formatted Static Pages. For example if you have a bunch of product pages that need to look the same but they have different titles, product image, and product description. For more information on how to do this and some examples please read the Geeklog Wiki about Staticpage Templates.

Configuration

The configuration options for the Static Pages plugin can be changed from the Configuration admin panel:

Static Pages Main Settings

Variable Default Value Description
allow_php true Allows you to globally allow or disallow the use of PHP in static pages, i.e. it overrides the setting on individual pages.
sort_by 'id' Define sort order when more than one static page is displayed in centerblocks. Allows sorting by page ID, page title, and date of last change.
sort_menu_by 'label' Define sort order for static pages in the site's menu. Allows sorting by page label, page ID, page title, and date of last change.
sort_list_by 'title' Defines the default sort order for the admin's list of static pages. Allows sorting by author, page ID, page title, and date of last change.
delete_pages false Specify what should happen to a static page when its owner (i.e. the user who created the page) is deleted. 'True' would delete the page, 'False' will assign it to a user in the "Root" group (usually the user with the lowest user ID). Note: If set to 'True' some pages may not be deleted. For example if the page is a template that is currently be used by other pages, or other security reasons. If this happens then the page will be assigned to a user in the "Root" group.
in_block true Whether to display the content of static pages inside a block template or not. This is the default setting and can be overridden per page.
show_hits true Whether to show the number of hits for a static page. This is also used for the default when creating a new page. Setting this to false overrides the per page setting.
show_date true Whether to show the date and time of the last change to a static page. This is also used for the default when creating a new page. Setting this to false overrides the per page setting.
filter_html false Whether HTML in static pages should be run through Geeklog's HTML filter option.
censor false Whether the content of the static page should be run through Geeklog's "bad words" filter.
aftersave 'list' Which page to go to after a static page has been saved:
  • 'item': display the page
  • 'list': show admin's list of static pages (default)
  • 'home': display the site's homepage
  • 'admin': go to the "Admin Home" page, i.e. Command & Control
atom_max_items 10 Max. number of static pages returned when an Atom feed is requested through the webservices API.
meta_tags false Whether to include the meta tags of the staticpage when it is displayed.
comment_code -1 Allows you to define whether new Static Pages will allow comments (0) or not (-1). This is only the default setting for new pages and can be overridden for every single page.
structured_data_type_default 1 Default Structured Data Type for new pages. To find out more about Structured Data and its integration into Geeklog see this page.
draft_flag 0 Default setting for new Static Pages: Whether the page's draft flag should be set (1) or not (0).
disable_breadcrumbs_staticpages 0 Whether the page's breadcrumbs should be displayed (0) or not (1).
default_cache_time 0 The default cache time for a staticpage. Possible values:
  • 1 or more = Amount of seconds a static page will be cached before it is regenerated and saved again to a new cache file.
  • 0 = Not cached. Page is always regenerated.
  • -1 = Always cached and only regenerated when the page is updated and saved through the staticpage editor.

What's New Block

Variable Default Value Description
newstaticpagesinterval 1209600 Static pages are "new" if they are this many seconds old.
hidenewstaticpages 'hide' Set to 'modified' date or 'created' date to display new static pages in the What's New block.
title_trim_length 20 Max. length of the title of items listed in the What's New block.
includecenterblocks false Set to true to include static pages that are displayed as a center block.
includephp false Set to true to include static pages that execute PHP.

Search Results

Variable Default Value Description
includesearch true Set to true to enable static pages in search results.
includesearchcenterblocks false Set to true to include static pages that are displayed as a center block.
includesearchphp false Set to true to include static pages that execute PHP.

Default Permissions

Variable Default Value Description
default_permissions[0] Read-Write Default permission for Owner of new page.
default_permissions[1] Read-Only Default permission for Group of new page.
default_permissions[2] Read-Only Default permission for all logged in users of new page.
default_permissions[3] Read-Only Default permission for all anonymous visitors of new page.

Autotag Usage Permissions

Variable Default Value Description
autotag_permissions_staticpage[0] Use Usage permission for autotag [staticpage: ] and [page: ] by autotag Owner (Default Root User).
autotag_permissions_staticpage[1] Use Usage permission for autotag [staticpage: ] and [page: ] by Static Page Admin Group.
autotag_permissions_staticpage[2] Use Usage permission for autotag [staticpage: ] and [page: ] by all logged in users.
autotag_permissions_staticpage[3] Use Usage permission for autotag [staticpage: ] and [page: ] by anonymous users.
autotag_permissions_staticpage_content[0] Use Usage permission for autotag [staticpage_content: ] and [page_content: ] by autotag Owner (Default Root User).
autotag_permissions_staticpage_content[1] Use Usage permission for autotag [staticpage_content: ] and [page_content: ] by Static Page Admin Group.
autotag_permissions_staticpage_content[2] Use Usage permission for autotag [staticpage_content: ] and [page_content: ] by all logged in users.
autotag_permissions_staticpage_content[3] Use Usage permission for autotag [staticpage_content: ] and [page_content: ] by anonymous users.

Autotags

The Static Pages Plugin provides 2 autotags, [staticpage:] and [staticpage_content:].