GetSimple plugin: GS Page Data

GSPageData is a plugin that provides some template tags (functions) to display (or return) other GetSimple pages' data (title, content, etc.)

Download GSPageData version 0.2 (beta)


Unzip file and upload contents (gspagedata.php) to your GetSimple site's plugins folder.


You can use tags in your template.php file, GetSimple components, your theme's functions.php file...

First select a page by its slug (identifier):

<?php set_gspage('slug'); ?>

Display that page data by using these functions (or template tags):

<?php gspage_title(); ?>
<?php gspage_url(); ?>
<?php gspage_content(); ?>
<?php gspage_excerpt(); ?>
<?php gspage_field('fieldname'); ?>


gspage_excerpt() echoes a maximum of 200 characters, unless a different number given as a parameter, e.g. <?php gspage_excerpt(120); ?>

gspage_field() displays the content of a field (built-in or custom) by giving the field's name as a parameter. It is echoed without filtering (no stripping html code, etc.). Example: <?php gspage_field('parent') ?>


- For one page:

<?php set_gspage('pageslug'); ?>
<b><a href="<?php gspage_url(); ?>"><?php gspage_title(); ?></a></b><br />
<?php gspage_excerpt(256); ?>

- For several pages (using an array of slugs):

<?php foreach(array('slug1','slug2','slug3') as $gspage): ?>
<?php set_gspage($gspage); ?>
<b><a href="<?php gspage_url(); ?>"><?php gspage_title(); ?></a></b>
<?php gspage_excerpt(150); ?>
<?php endforeach; ?>

Advanced usage (parameters and returning values):

- You can get a field's value without displaying it by passing a FALSE (or 0) parameter to a tag. Examples:

$myTitle = gspage_title(0);
$myTitle = gspage_title(false); // same as previous one
$WebPage = gspage_url(false);
$myExcerpt = gspage_excerpt(200,false);
$myCustomField = gspage_field('customfield',0);

- function set_gspage('slug') returns FALSE if the page with id 'slug' does not exist, so you can use that to check it before displaying:

<?php if (set_gspage('slug')):?>
<?php endif; ?>



- I will probably rename this plugin to "GSpages"
- New functions will be added, and some of the current may change (name, parameters...)
- Here's a draft TO-DO list