The pages module includes the following functions. You can use these in templates as well as layouts (though they are used primarily in layouts). All functions //return// values and //never echo// them, so that further operations can be made by themers/plugins/etc.
**pageText( [int $id/string $slug] )**
returns //html//
Returns the page text, which can include HTML. Formatted with nl2br().
**pageSlug()**
returns ///string//
Returns the current page's slug.
**pageId()**
returns //int//
Returns the current page's database id.
**pageContent( [int $id/string $slug] )**
varied return value, otherwise //null//
This function utilises the Page Type option by calling the chosen module types' display function. The results of that function are returned.
If the chosen type is 'projects', the //projects()// function will be called and the result will be HTML containing the projects. The HTML is taken from the projects template. Simply echo this function to display the result.
If no id or slug is supplied, the current page's content is displayed.
**pageList()**
returns //html//
Returns an HTML list for use in menus. Here is a sample list (note the 'active' class, which is automatically appended for CSS styling):
**indexPage()**
returns //string//
This function returns the slug of the index page, which is set under Pages - Settings.
**pageSelected()**
returns //true// or //false//
Returns true if the user is viewing a page (as opposed to a project or something else).
**currentPage()**
returns //string//
Returns the the slug of the current page. Also accessible through the constant PAGE.
**pageInfo( int $id/string $slug )**
returns //array//
This function returns an array, directly from the database, containing all information about the requested page.
Example usage:
pageInfo( indexPage() );
**linkToPage( int $id/string $slug )**
returns //string//
This function creates a URL that can be used in an HTML link tag. It is automatically adjusted based on the clean URLs option. Used internally in the pageList() function.