FUEL CMS User Guide : Version 1.5.2


Fuel Pages Class

This class is used to find and create Fuel_page objects.

This class extends the Fuel_base_library class.

Properties Reference

Property Default Value Description
protected
_active N/A The currently active page

Function Reference [+]

$this->fuel->pages->create([$init=array()], ['$set_active'=TRUE])

Creates a Fuel_page.

Returns

object

Parameters

(array) $init Page initialization preferences
(boolean) $set_active Sets the page as the currently active

$this->fuel->pages->set_active('$page')

Sets a page as the currently active page.

Returns

void

Parameters

(object) $page The page to set as active

$this->fuel->pages->get('$location', [$init=array()])

Returns a Fuel_page object given a provided location.

Returns

object

Parameters

(string) $location The page to set as active
(array) $init An array of initializtion parameters

$this->fuel->pages->active()

Returns the active page.

Returns

object

$this->fuel->pages->options_list(['$include'='all'], ['$paths_as_keys'=FALSE], ['$apply_site_url'=TRUE])

Returns an associative array of pages used for form option lists.

Returns

array

Parameters

(string) $include The types of pages to include in the array. Options are cms, modules, views (optional)
(boolean) $paths_as_keys Determines whether to use the URI location as the key (optional)
(boolean) $apply_site_url Applies the site_url() to the keys of the returned array (optional)

$this->fuel->pages->views(['$subfolder'=''])

Returns an array of view files pages used with opt-in controller method.

Returns

array

Parameters

(string) $subfolder name of view subfolder to search

$this->fuel->pages->cms()

Returns an array of pages created in the CMS.

Returns

array

$this->fuel->pages->modules()

Returns an array of pages created by a module. The module must have a prevew path.

Returns

array

$this->fuel->pages->find('$id')

Finds a FUEL page based on either a location or ID value and returns an array of properties.

Returns

array

Parameters

(mixed) $id Either the pages location or ID value (CMS only)

$this->fuel->pages->children('$root', ['$objectify'=FALSE])

Returns an array of children page objects based on the root page.

Returns

array

Parameters

(string) $root The root page location value to search from
(boolean) $objectify Determines whether to return objects or not

$this->fuel->pages->mode()

Returns the rendering mode for the pages module.

Returns

boolean

$this->fuel->pages->render('$location', [$vars=array()], [$params=array()], ['$return'=FALSE])

Renders a Fuel_page which includes any inline editing markers. The 3rd parameter can contain Fuel_page class properties (e.g. array('render_mode' => 'cms')).

Returns

string

$this->fuel->pages->import('$page', ['$sanitize'=TRUE])

Imports a block view file into the database.

Returns

string

Parameters

(string) $page The name of the page to import to the CMS
(boolean) $sanitize Determines whether to sanitize the page by applying the php to template syntax function before uploading


Fuel Page Class

Can be retrieved by $this->fuel->pages->get('{location}').

This class extends the Fuel_base_library class.

Properties Reference

Property Default Value Description
public
id none The page ID if it is coming from a database
location none The uri location
layout none The layout file to apply to the view
is_published 1 Whether the page can be seen or not
is_cached 1 Is the file cached in the system cache directory
views_path none The path to the views folder for rendering. Used with modules
render_mode views Values can be either "views" or "cms"
view_module app The module to look for the view file
language none The language to use for rendering both a static view and CMS page
markers
array()
The inline editing markers for the page
include_pagevar_object 1 Includes a $pagevar object that contains the variables for the page
vars_honor_page_status none Determines whether to honor the page's published status when pulling variable data from the CMS
only_published 1 View only published pages is used if the person viewing page is not logged in
marker_key __FUEL_MARKER__ Used for placing inline editing content in the output
protected
_variables N/A Variables applied to the page
_segments N/A Uri segments to pass to the page
_page_data N/A Specific data about the page (not variables being passed necessarily)
_fuelified N/A Is the person viewing the page logged in?... If so we will make inline editing and toolbar visible
_fuelified_processed N/A If fuelify has already been called

Function Reference [+]

$page->initialize([$params=array()])

Initialize the user preferences. Accepts an associative array as input, containing display preferences. If a string is passed it will assume it is the location property.

Returns

void

Parameters

(mixed) $params config preferences

$page->assign_location('$location')

Assigns the location value of the page.

Returns

void

Parameters

(string) $location location to assign to the page

$page->assign_variables(['$views_path'=NULL], ['$page_mode'=NULL])

Assigns variables to the page.

Returns

void

Parameters

(string) $views_path The server path to the views file (optional)
(string) $page_mode Determines whether to assign variables from the CMS as well as variables from the _variables folder (optional)

$page->assign_layout('$layout')

Assigns the layout of the page.

Returns

void

Parameters

(mixed) $layout Can be either a name of the layout or a Fuel_layout object

$page->render(['$return'=FALSE], ['$fuelify'=TRUE])

Renders the page either from the CMS or via the "opt-in controller" method. Pages in the CMS take precedence.

Returns

string

Parameters

(boolean) $return Determines whether to return the value or to echo it out (optional)
(boolean) $fuelify Determines whether to render any inline editing (optional)

$page->cms_render(['$return'=FALSE], ['$fuelify'=FALSE])

Renders a CMS page.

Returns

string

Parameters

(boolean) $return Determines whether to return the value or to echo it out
(boolean) $fuelify Determines whether to render any inline editing

$page->variables_render(['$return'=FALSE], ['$fuelify'=FALSE])

Renders a static view page that is using the "opt-in controller" method.

Returns

string

Parameters

(boolean) $return Determines whether to return the value or to echo it out (optional)
(boolean) $fuelify Determines whether to render any inline editing (optional)

$page->modules_render(['$return'=FALSE], ['$fuelify'=FALSE])

Renders a page by checking the modules "pages" config parameter.

Returns

string

Parameters

(boolean) $return Determines whether to return the value or to echo it out (optional)
(boolean) $fuelify Determines whether to render any inline editing (optional)

$page->load_resources(['$vars'=NULL])

Loads any resources by checking for a "library", "helpers", or "models" variable assigned to the page.

Returns

void

Parameters

(array) $vars An array of variables to check for resources

$page->fuelify('$output')

Renders the inline editing markers before final output.

Returns

string

Parameters

(string) $output The output to be rendered

$page->add_marker($marker)

Adds marker code to the page for inline editing areas and returns a unique key value to identify it during the final rendering process.

Returns

string

Parameters

(array) $marker An array of marker values which includes, id, label, module, published, xoffset, and yoffset values

$page->get_marker_prefix()

Returns the marker prefix used for adding markers.

Returns

string

$page->get_marker_regex()

Returns the regular expression needed to find markers on the page.

Returns

string

$page->render_marker('$key')

Renders a marker on the page which is used on the front end to create the inline editng pencil icons with some javascript.

Returns

string

Parameters

(string) $key The markers key value used to identify it on the apge

$page->render_all_markers('$output')

Finds all the markers in the output and renders them.

Returns

string

Parameters

(string) $output The output of the page

$page->remove_markers('$output')

Finds all the markers in the output and renders them.

Returns

string

Parameters

(string) $output The output of the page

$page->properties(['$prop'=NULL])

Returns the Fuel_page properties which includes location, layout, published and cached values.

Returns

string

Parameters

(string) $prop The output of the page (optional)

$page->variables(['$key'=NULL])

Returns all the variables currently assigned to the page for rendering.

Returns

string

Parameters

(string) $key The output of the page

$page->add_variables([$vars=array()])

Adds variables to the page for rendering.

Returns

void

Parameters

(array) $vars An array of variables to assign to the page for rendering

$page->segment(['$n'=NULL])

Returns segment value(s) passed to a CMS page. For example, a page with a location of "projects" in the CMS can have segment parameters passed to it (e.g. projects/123456). The FUEL config value of "max_page_params" must have a value greater then 0 (which is the default) for parameters to be passed. If no segment number is specified, all segments will be returned.

Returns

string

Parameters

(string) $n The segment number to return (optional)

$page->has_cms_data()

Returns whether the page is from the CMS or not.

Returns

string

$page->is_cached()

Returns whether the page should be cached.

Returns

boolean

$page->save()

Saves a page to the CMS.

Returns

boolean

$page->delete()

Deletes a page from the CMS.

Returns

boolean

$page->find_view_file('$view', ['$depth'=NULL])

Uses the assigned "location" value to scan the views directory for a corresponding view file. The Fuel configuration value of "auto_search_views" must be set to TRUE or a number greater than 1 (it is FALSE by default). If a number is provided, it will loop.

Returns

string

Parameters

(string) $view The original location value.
(int) $depth The number of levels deep to search for a view

$page->get_max_page_param()

Returns the maximum number of page parameters associated with the current page.

Returns

int