-
Notifications
You must be signed in to change notification settings - Fork 19
/
staticpages.html
351 lines (280 loc) · 20.7 KB
/
staticpages.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Geeklog Documentation - Static Pages Plugin</title>
<link rel="stylesheet" type="text/css" href="../docstyle.css" title="Dev Stylesheet" />
</head>
<body>
<p><a href="https://www.geeklog.net/" style="background:transparent"><img src="../images/newlogo.gif" alt="Geeklog" width="243" height="90" /></a></p>
<div class="menu"><a href="index.html">Geeklog Documentation</a> - Static Pages Plugin</div>
<h1>Static Pages plugin</h1>
<h2><a name="about">What is it?</a></h2>
<p>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.</p>
<p>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 ...</p>
<h2><a name="features">Features</a></h2>
<ul>
<li>supports <a href="#php">use of PHP</a></li>
<li><a href="#id">editable page ID</a> to make more readable URLs</li>
<li>Static pages can be displayed on Geeklog's <a href="#frontpage">index and topic pages</a> and can even replace it entirely ("splash screen")</li>
<li>"<a href="#cloning">cloning</a>" of existing pages</li>
<li>Makes use of Geeklog's <a href="#url">URL rewrite feature</a></li>
<li>Provides <a href="#autotags">two autotags</a></li>
<li>proper support for Geeklog permissions</li>
</ul>
<h2><a name="php">Use of PHP</a></h2>
<h3><a name="activation">Activating PHP</a></h3>
<p><strong>Important:</strong> 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.</p>
<p>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.</p>
<h3><a name="usage">Usage</a></h3>
<p style="text-align:center"><em>The use of PHP in static pages may result in security issues if not used properly. Use this feature with care!</em></p>
<p>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:</p>
<ul>
<li>do not execute PHP<br />
Obivously, when you select this option, any PHP code in the static page will <em>not</em> be executed but will instead be printed out as-is.</li>
<li>execute PHP (return)<br />
If you select this option, PHP code in static pages <em>will</em> be executed. The 'return' indicates that the code should return any output it generates, using a PHP <code>return</code> statement, instead of printing it out directly. This is the PHP option as introduced with the Static Pages plugin 1.3.</li>
<li>execute PHP<br />
Again, this option <em>will</em> enable execution of PHP. Only this time, the PHP code can actually use <code>echo</code> and <code>print</code> statements without having the output interfere with the page layout.</li>
</ul>
<p>Please note that when embedding PHP code in a static page, your code should <em>not</em> be enclosed in the PHP <code><?php</code> and <code>?></code> tags. Instead, it is assumed that the static page contains the PHP code that would normally go <em>between</em> those two tags.</p>
<p>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:</p>
<pre style="padding-left: 2em"><code>echo "Hello"; ?>, <b>world</b>, <?php echo "how are you?";</code></pre>
<p>The above example would print out "Hello, <strong>world</strong>, how are you?".</p>
<h2><a name="id">Page ID</a></h2>
<p>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.</p>
<p>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</p>
<p style="margin-left:4em;"><span class="tt">http://yoursite/staticpages/index.php?page=about</span></p>
<p>which looks much nicer when quoted (and is easier to remember). You could further improve this by making use of Geeklog's <a href="#url">URL rewrite feature</a>.</p>
<p>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 ...</p>
<h2><a name="multi-language">Multi Language Support</a></h2>
<p>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 <a href="https://www.geeklog.net/docs/english/config.html#languages">language config settings</a> 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 <a href="http://wiki.geeklog.net/index.php/Multi-Language_Support">Geeklog's Multi-Lanaguage Wiki support page</a>.</p>
<h2><a name="frontpage">Using Static Pages on the index page</a></h2>
<p>Geeklog's Center Blocks concept allows plugins to place blocks in the center area of a Geeklog site, i.e. among the stories.</p>
<p>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.</p>
<p><strong>Tip:</strong> 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 <code>index.php?display=all</code></p>
<p>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.</p>
<p><strong>Tip:</strong> 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.</p>
<h3><a name="sort">Sorting</a></h3>
<p><strong>Centerblocks:</strong> 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:</p>
<ul>
<li>Date (sort by last changed date)</li>
<li>Page ID (sort by the page id; default)</li>
<li>Page Title (sort by the page title)</li>
</ul>
<p>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.</p>
<p><strong>Menu entries:</strong> 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 <code>{plg_menu_elements}</code> variables in its <span class="tt">header.thtml</span>). This sort order can also be changed in the Configuration admin panel for the static pages plugin:</p>
<ul>
<li>Date (sort by last changed date)</li>
<li>Label (sort by the menu label text; default)</li>
<li>Page ID (sort by the page id)</li>
<li>Page Title (sort by the page title)</li>
</ul>
<h2><a name="block">Wrapping Static Pages in a block</a></h2>
<p>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.</p>
<p>The default for this option can be set in the Configuration admin panel for the static pages plugin.</p>
<h2><a name="cloning">Cloning Static Pages</a></h2>
<p>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.</p>
<h2><a name="url">URL rewriting</a></h2>
<p style="text-align:center"><em>Please note that this feature is considered experimental and is known not to work with IIS.</em></p>
<p>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</p>
<p style="margin-left:4em;"><span class="tt">http://yoursite/staticpages/index.php?page=20030313100131123</span></p>
<p>the URL could look like this</p>
<p style="margin-left:4em;"><span class="tt">http://yoursite/staticpages/index.php/20030313100131123</span></p>
<p>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 <a href="#id">replacing the numeric page ID</a> with a word or expression (preferrably something that corresponds to the page's content), e.g.</p>
<p style="margin-left:4em;"><span class="tt">http://yoursite/staticpages/index.php/about</span></p>
<p>To make use of URL rewriting, you will need to set the option "Enable URL Rewriting" to True in Geeklog's Configuration admin panel.</p>
<h2><a name="delete">Deleting pages with their owner</a></h2>
<p>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.</p>
<p>In the Configuration admin panel for the static pages plugin, you can set the "<a href="#desc_delete_pages">Delete Pages with Owner?</a>" 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.</p>
<h2><a name="template">Template Static Pages</a></h2>
<p>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 <a href="http://wiki.geeklog.net/Static_Pages_Plugin#Template_Static_Pages">Staticpage Templates</a>.</p>
<h2><a name="config.php">Configuration</a></h2>
<p>The configuration options for the Static Pages plugin can be changed from
the Configuration admin panel:</p>
<h3><a name="main">Static Pages Main Settings</a></h3>
<table>
<tr><th style="width:25%">Variable</th>
<th style="width:25%">Default Value</th>
<th style="width:50%">Description</th>
</tr>
<tr>
<td><a name="desc_allow_php">allow_php</a></td>
<td>true</td>
<td>Allows you to globally allow or disallow the <a href="#php">use of PHP</a>
in static pages, i.e. it overrides the setting on individual pages.</td>
</tr>
<tr class="r2">
<td><a name="desc_sort_by">sort_by</a></td>
<td>'id'</td>
<td>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.</td>
</tr>
<tr>
<td><a name="desc_sort_menu_by">sort_menu_by</a></td>
<td>'label'</td>
<td>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.</td>
</tr>
<tr class="r2">
<td><a name="desc_sort_list_by">sort_list_by</a></td>
<td>'title'</td>
<td>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.</td>
</tr>
<tr>
<td><a name="desc_delete_pages">delete_pages</a></td>
<td>false</td>
<td>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.</td>
</tr>
<tr class="r2">
<td><a name="desc_in_block">in_block</a></td>
<td>true</td>
<td>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.</td>
</tr>
<tr>
<td><a name="desc_show_hits">show_hits</a></td>
<td>true</td>
<td>Whether to show the number of hits for a static page. This is also used for the default per page setting and it overrides the per page setting.</td>
</tr>
<tr class="r2">
<td><a name="desc_show_date">show_date</a></td>
<td>true</td>
<td>Whether to show the date and time of the last change to a static page. This is also used for the default per page setting and it overrides the per page setting.</td>
</tr>
<tr>
<td><a name="desc_filter_html">filter_html</a></td>
<td>false</td>
<td>Whether HTML in static pages should be run through Geeklog's HTML filter
option.</td>
</tr>
<tr class="r2">
<td><a name="desc_censor">censor</a></td>
<td>false</td>
<td>Whether the content of the static page should be run through Geeklog's
"bad words" filter.</td>
</tr>
<tr>
<td><a name="desc_aftersave">aftersave</a></td>
<td>'list'</td>
<td>Which page to go to after a static page has been saved:
<ul>
<li>'item': display the page</li>
<li>'list': show admin's list of static pages (default)</li>
<li>'home': display the site's homepage</li>
<li>'admin': go to the "Admin Home" page, i.e. Command & Control</li>
</ul></td>
</tr>
<tr class="r2">
<td><a name="desc_atom_max_items">atom_max_items</a></td>
<td>10</td>
<td>Max. number of static pages returned when an Atom feed is requested
through the webservices API.</td>
</tr>
<tr>
<td><a name="desc_meta_tags">meta_tags</a></td>
<td>false</td>
<td>Whether to include the meta tags of the staticpage when it is displayed.</td>
</tr>
<tr class="r2">
<td><a name="desc_comment_code">comment_code</a></td>
<td>-1</td>
<td>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.</td>
</tr>
<tr>
<td><a name="desc_draft_flag">draft_flag</a></td>
<td>0</td>
<td>Default setting for new Static Pages: Whether the page's draft flag should be set (1) or not (0).</td>
</tr>
<tr>
<td><a name="desc_disable_breadcrumbs_staticpages">disable_breadcrumbs_staticpages</a></td>
<td>0</td>
<td>Whether the page's breadcrumbs should be displayed (0) or not (1).</td>
</tr>
<tr class="r2">
<td><a name="desc_default_cache_time">default_cache_time</a></td>
<td>0</td>
<td>The default cache time for a staticpage. Possible values:<br />
<ul>
<li>1 or more = Amount of seconds a static page will be cached before it is regenerated and saved again to a new cache file.</li>
<li>0 = Not cached. Page is always regenerated.</li>
<li>-1 = Always cached and only regenerated when the page is updated and saved through the staticpage editor.</li>
</ul>
</td>
</tr>
</table>
<h3><a name="whatsnew">What's New Block</a></h3>
<table>
<tr><th style="width:25%">Variable</th>
<th style="width:25%">Default Value</th>
<th style="width:50%">Description</th>
</tr>
<tr>
<td valign="top"><a name="desc_newstaticpagesinterval">newstaticpagesinterval</a></td>
<td valign="top">1209600</td>
<td valign="top">Static pages are "new" if they are this many seconds old.</td></tr>
<tr class="r2">
<td valign="top"><a name="desc_hidenewstaticpages">hidenewstaticpages</a></td>
<td valign="top">'hide'</td>
<td valign="top">Set to 'modified' date or 'created' date to display new static pages in the What's New block.</td></tr>
<tr>
<td valign="top"><a name="desc_title_trim_length">title_trim_length</a></td>
<td valign="top">20</td>
<td valign="top">Max. length of the title of items listed in the What's New block.</td></tr>
<tr class="r2">
<td valign="top"><a name="desc_includecenterblocks">includecenterblocks</a></td>
<td valign="top">false</td>
<td valign="top">Set to true to include static pages that are displayed as a center block.</td></tr>
<tr>
<td valign="top"><a name="desc_includephp">includephp</a></td>
<td valign="top">false</td>
<td valign="top">Set to true to include static pages that execute PHP.</td></tr>
</table>
<h3><a name="search">Search Results</a></h3>
<table>
<tr><th style="width:25%">Variable</th>
<th style="width:25%">Default Value</th>
<th style="width:50%">Description</th>
</tr>
<tr>
<td valign="top"><a name="desc_includesearch">includesearch</a></td>
<td valign="top">true</td>
<td valign="top">Set to true to enable static pages in search results.</td></tr>
<tr class="r2">
<td valign="top"><a name="desc_includesearchcenterblocks">includesearchcenterblocks</a></td>
<td valign="top">false</td>
<td valign="top">Set to true to include static pages that are displayed as a center block.</td></tr>
<tr>
<td valign="top"><a name="desc_includesearchphp">includesearchphp</a></td>
<td valign="top">false</td>
<td valign="top">Set to true to include static pages that execute PHP.</td></tr>
</table>
<h2><a name="autotags">Autotags</a></h2>
<p>The Static Pages Plugin provides 2 <a href="https://www.geeklog.net/article.php/autolinks" title="geeklog.net: About Autolinks and Autotags">autotags</a>,
<code>[staticpage:]</code> and <code>[staticpage_content:]</code>.</p>
<ul>
<li>The <code>[staticpage:]</code> autotag will provide a link to a static page.
Simply add the page's ID after the colon. By default, the title of the
static page will be used as the link text. You can provide your own link
text after the page ID (but before the closing bracket).</li>
<li>The <code>[staticpage_content:]</code> autotag will be replaced with the
contents of the static page in question. This can be useful when you need
to use a piece of text in more than one place.</li>
</ul>
<div class="footer">
<a href="http://wiki.geeklog.net/">The Geeklog Documentation Project</a><br />
All trademarks and copyrights on this page are owned by their respective owners. Geeklog is copyleft.
</div>
</body>
</html>