![]() |
Geeklog Documentation - Static Pages plugin |
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 allows the use of PHP in Static Pages and also supports proper Geeklog permissions.
With Geeklog 1.3.8 and Static Pages 1.3 these two versions have now been merged again. Static Pages 1.3 also includes some new features that were not included in either of its predecessors.
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. Make sure you check the PHP checkbox below the content edit field. If that checkbox is not checked, your PHP code will be displayed as the page's content instead (i.e. it will not be executed).
To use PHP, the person editing the Static Page will also need to have "staticpages.PHP" permission. This is the default for all users in the "Static Page Admin" group, but you could create a second Admin group with only the "staticpages.edit" and "staticpages.delete" permissions if you don't want to allow all your Static Page Admins to make use of PHP.
Please note that when you enable PHP for a Static Page, the content of the page is treated as PHP source, i.e. you will need to write PHP code. Some examples may help:
Example 1 (wrong!)
<?php
return "This is a test";
?>
This is not a test.
With PHP enabled, this will not display anything at all. With PHP disabled, it will only display "This is not a test."
Why? Because everything between <?php
and ?>
will always be stripped out, whether the page has been set to PHP mode or not.
Example 2 (good)
return "This is a test";
With PHP enabled, this will display "This is a test". With PHP disabled, it will display the entire PHP code, i.e. return "This is a test";
Example 3 (wrong)
echo "This is a test";
With PHP enabled, this will display "This is a test" - but not where you would expect it. When using PHP in Static Pages, you should not use echo
or print
but return the content you want to be displayed using a return
statement (see example 2).
<?php
and ?>
tags.echo
or print
.return
to return the content you want to be displayed.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 ...
Geeklog 1.3.8 introduces 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.
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 Static Pages' 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.
Static Pages will be wrapped in a block when $_SP_CONF['in_block']
is set to 1
(in the plugin's config.php file). The title of the Static Page is then used as the block title.
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.
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 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.
The Geeklog Documentation Project All trademarks and copyrights on this page are owned by their respective owners. GeekLog is copyleft. |