Special Pages (I18N enabled)

The I18N Special Pages plugin allows you to define types of pages with custom fields, customized behaviour and customized display.

Together with the I18N Search plugin you can easily create (fully searchable)

  • News
  • Blogs
  • Product lists
  • etc.

Features:

  • define custom fields (including default values) per page type
  • define default values for slug, parent, etc.
  • define a default content, e.g. to provide a standard layout of a product description
  • define directly, how the page should be displayed, instead of using a template
  • customize, how the page shall be displayed as search result
  • sample page type templates included - page type definitions can be easily shared
  • stores creation date (field 'creDate') and user (field 'user') in pages

Installation

Download the plugin from here and unzip it to the plugins directory of your GetSimple installation.

For an optimum experience you should also install

You can install I18N Custom Fields for global custom fields (for all pages).

USAGE

Go to the Plugins/Configure I18N Special Pages of your GetSimple administration and configure your special pages. You can start by using one of the supplied templates.

  • you can set some default values for new pages,
  • you can add custom fields and set default values for them and the content of the page. You can define which fields are indexed by I18N Search (if installed),
  • you can define how to display the page together with its custom fields,
  • you can define how to display the page as part of a search result (if you have I18N Search installed).

Once you have finished defining a special page type, you can create a page of this type by going to Pages/Create new Special Page.

You can list special pages either with all other pages in Pages/View all Pages or in Pages/View all Special Pages.

With I18N Search installed:

All content and all custom fields that are enabled for indexing, will be searched with a normal search.

To search for special pages, e.g. products, create a page with:

(% searchform addtags=_special_product %)
(% searchresults addtags=_special_product %)

API

Note: field names are always converted to lower case, thus you have to use e.g. get_special_field('productdescription') to output the field with name ProductDescription.

You can use the following function to access the additional fields:

  • get_special_field($name, $default='', $isHTML=true) will output the field. Set $isHTML to false, if the content is text - special characters like < and > will then be encoded.
  • get_special_field_date($name, $format=null) outputs a formatted date. The field must be a numeric UNIX timestamp or a formatted string like the field pubDate. The $format must conform to the specification for the PHP function strftime.
  • (0.9+) get_special_tags($slug=null, $separator=' ', $all=false) outputs the tags (except the technical tags like _special_xxx) separated by the $separator. If $slug is set (to a I18N search result page), the tags will be output as links for a search; if $all is false, only search results for that special page type will be found.

  • (1.1+) get_special_field_image($name, $title=null, $width=null, $height=null, $crop=null) outputs an image tag to the image given in the field $name or a scaled version if $width and/or $height is given. If $crop is false the image is scaled to have at most $width/$height dimensions, with $crop it is cropped to exacly fit the width/height ratio. The title and alt of the image are set to $title.

  • (0.9+) return_special_page_type() will return the special page type.
  • return_special_field($name, $default='') returns the field.
  • return_special_field_date($name, $format=null) will return the formatted date.
  • (1.1+) return_special_field_image($name, $width=null, $height=null, $crop=null) will return the link to the image or its scaled version.

If you have I18N Search installed, you can also use the following functions:

  • get_special_field_excerpt($name, $length) outputs an excerpt of the field. $length can be a positive number for the number of words or a positive number followed by 'p' or 'pm' for the number of paragraphs (pm: add a <p>...</p> if there is more content) or a negative number for the whole content.
  • return_special_field_excerpt($name, $length) will return an excerpt object with the properties text (the excerpt text) and more (true, if there is more text).