Difference between revisions of "Misc. Functions"

From GeeklogWiki
Jump to: navigation, search
m
m (Misc. Functions: No topic id (as written in lib-plugins.php))
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
 
         <td valign="top" class="codeheader">plugin_centerblock_&lt;plugin name&gt;</td>
 
         <td valign="top" class="codeheader">plugin_centerblock_&lt;plugin name&gt;</td>
 
         <td valign="top" class="code">Plugins can display a block in the site's center area, i.e. among the stories. This function is called several times during rendering of the site's index page. The parameters will tell the plugin where on the index page the block would appear.<br>
 
         <td valign="top" class="code">Plugins can display a block in the site's center area, i.e. among the stories. This function is called several times during rendering of the site's index page. The parameters will tell the plugin where on the index page the block would appear.<br>
Parameters are <code>where</code> (1 = top of page, 2 = after the featured story, 3 = bottom of page and 0 = full page), <code>page</code> (page number) and the <code>topic id</code>.
+
Parameters are <code>where</code> (1 = top of page, 2 = after the featured story, 3 = bottom of page and 0 = full page), <code>page</code> (page number) and the <code>topic</code> (topic id. None = means the user is in the front page).
 
<br>As mentioned, the first parameter, <code>where</code>, can also be 0 which means that the plugin can take over the entire page if it wants to and thus make the CMS just serve as infrastructure for the plugin (of course, in this case it will have to return the HTML for the <em>entire page</em>, i.e. including site header and footer).<br>
 
<br>As mentioned, the first parameter, <code>where</code>, can also be 0 which means that the plugin can take over the entire page if it wants to and thus make the CMS just serve as infrastructure for the plugin (of course, in this case it will have to return the HTML for the <em>entire page</em>, i.e. including site header and footer).<br>
 
The function should return the complete HTML for the block (including header and footer) or an empty string.</td>
 
The function should return the complete HTML for the block (including header and footer) or an empty string.</td>

Latest revision as of 18:55, 25 December 2008

The following is a list of (optional) functions for misc. purposes:

Misc. Functions

Table 9. Misc. functions
Function Description of Function
plugin_centerblock_<plugin name> Plugins can display a block in the site's center area, i.e. among the stories. This function is called several times during rendering of the site's index page. The parameters will tell the plugin where on the index page the block would appear.

Parameters are where (1 = top of page, 2 = after the featured story, 3 = bottom of page and 0 = full page), page (page number) and the topic (topic id. None = means the user is in the front page).
As mentioned, the first parameter, where, can also be 0 which means that the plugin can take over the entire page if it wants to and thus make the CMS just serve as infrastructure for the plugin (of course, in this case it will have to return the HTML for the entire page, i.e. including site header and footer).

The function should return the complete HTML for the block (including header and footer) or an empty string.
plugin_getheadercode_<plugin name> Plugins may add additional lines to the site's <head> tag by implementing this function, e.g. Javascript functions or additional Meta tags.
The function should return a concatenated string of all its extra header code.
plugin_whatsnewsupported_<plugin name> Plugins can add their own section to Geeklog's What's New block by implementing this and the following function.
The function should return an array of 2 strings. The first string is used as the headline for the plugin's section in What's New and the second string is used to indicate the timespan that the entries in this section cover (e.g. "last 2 weeks").
plugin_getwhatsnew_<plugin name> This function should return the actual new entries to be listed in the What's New block (as an array) or a string to be displayed in case there are no new entries.