FUEL CMS User Guide : Version 1.5.2


Fuel Posts Class

This class extends the Fuel_base_library class.

Properties Reference

Property Default Value Description
protected
module N/A
_settings N/A
_current_post N/A
matched_segments N/A
page_type N/A

Function Reference [+]

$this->fuel->posts->set_module('$module')

Sets the current model object to be used for posts.

Returns

object

Parameters

(string) $module The simple module name or object

$this->fuel->posts->get_module()

Returns the module for the posts.

Returns

object

$this->fuel->posts->base_uri()

Returns the base URI for posts.

Returns

string

$this->fuel->posts->url(['$uri'=''])

Returns a URL based on the base_uri value.

Returns

string

$this->fuel->posts->module_config(['$key'=NULL], ['$module'=NULL])

Returns the all the segments as a string without the base_uri() value.

Returns

mixed

Parameters

(string) $key The key value in the $config['posts']['my_module'][$key] (optional)
(string) $module The module's name to grab the config information from (optional)

$this->fuel->posts->page_type()

The view to use based on the routes and the current URI.

Returns

string

$this->fuel->posts->routes(['$module'=NULL])

Returns an array of all the routes that can be used for this module.

Returns

array

$this->fuel->posts->matched_segments()

This is a subset of the segments method that only includes those segments that were matched in the routes regular expression string(e.g. with "(...)").

Returns

array

$this->fuel->posts->matched_segment('$n')

Returns a single matched segment.

Returns

string

Parameters

(int) $n The matched segment number to return

$this->fuel->posts->pagination('$total_rows', '$base_url')

Returns the pagination string.

Returns

string

Parameters

(int) $total_rows The total number of rows that the pagination should use
(mixed) $base_url The base URL for the pagination

$this->fuel->posts->is_home()

Returns a boolean value whether it is the home page.

Returns

boolean

$this->fuel->posts->model()

Returns a the specified posts model object.

Returns

object

$this->fuel->posts->current_post()

Returns the current post for the page. Only set when viewing a single post.

Returns

object

$this->fuel->posts->get_recent_posts(['$limit'=5], [$where=array()])

Returns the most recent posts.

Returns

array

Parameters

(int) $limit The limit of results (optional)
(mixed) $where The where condition to limit the results by -- can be a string or an array (optional)

$this->fuel->posts->get_posts([$where=array()], ['$order_by'=NULL], ['$limit'=NULL], ['$offset'=NULL])

Returns posts based on specific query parameters.

Returns

array

Parameters

(mixed) $where The where condition to limit the results by -- can be a string or an array (optional)
(string) $order_by The order of the results (optional)
(int) $limit The limit of results (optional)
(int) $offset The offset of the results (optional)

$this->fuel->posts->get_posts_count([$where=array()])

Returns the number of posts.

Returns

array

Parameters

(mixed) $where The where condition to limit the results by -- can be a string or an array (optional)

$this->fuel->posts->get_post('$slug', ['$order_by'=NULL])

Returns a single post.

Returns

object

Parameters

(mixed) $slug Can be id or slug
(string) $order_by The order of the results (optional)

$this->fuel->posts->get_category_posts('$category', ['$order_by'=NULL], ['$limit'=NULL], ['$offset'=NULL])

Returns the most recent posts for a given category.

Returns

array

Parameters

(string) $category The category slug or ID value to search -- can also be a Fuel_category_model object (optional)
(string) $order_by The order of the results (optional)
(int) $limit The limit of results (optional)
(int) $offset The offset of the results (optional)

$this->fuel->posts->get_tag_posts('$tag', ['$limit'=NULL], ['$offset'=NULL])

Returns the posts for a given tag.

Returns

array

Parameters

(string) $tag The tag slug or ID value to search -- can also be a Fuel_tag_model object (optional)
(int) $limit The limit of results
(int) $offset The offset of the results

$this->fuel->posts->get_archives(['$year'=NULL], ['$month'=NULL], ['$day'=NULL], ['$limit'=NULL], ['$offset'=NULL], ['$order_by'=NULL])

Returns posts by providing a given date.

Returns

array

Parameters

(int) $year The 4 digit year
(int) $month The year as an integer with 1 being January and 12 being December
(int) $day The day of the month
(int) $limit The limit of results
(int) $offset The offset of the results
(string) $order_by The order of the results

$this->fuel->posts->get_next_post('$current_post')

Returns the next post (if any) from a given date.

Returns

object

Parameters

(object) $current_post The current post

$this->fuel->posts->get_prev_post('$current_post')

Returns the previous post (if any) from a given date.

Returns

object

Parameters

(object) $current_post The current post

$this->fuel->posts->get_published_categories()

Returns all the categories from published posts. (optional).

Returns

array

$this->fuel->posts->get_published_tags()

Returns all the tags from published posts. (optional).

Returns

array

$this->fuel->posts->get_post_archives([$where=array()], ['$limit'=NULL], ['$offset'=NULL])

Returns posts grouped by the year/month.

Returns

array

Parameters

(mixed) $where The where condition to limit the results by. Can be a string or an array. (optional)
(int) $limit The limit of results (optional)
(int) $offset The offset of the results (optional)

Searches posts for a specific term.

Returns

array

Parameters

(mixed) $term The term to search for
(int) $limit The limit of results (optional)
(int) $offset The offset of the results (optional)
(string) $order_by The order of the results (optional)

$this->fuel->posts->per_page()

Returns the per page pagination value.

Returns

int  The number of posts to limit per pagination view

$this->fuel->posts->view()

The view name.

Returns

string

$this->fuel->posts->layout()

The name of the layout to use for rendering.

Returns

string

$this->fuel->posts->vars_method()

A custom method on the model to use for variables to pass to the view.

Returns

string

$this->fuel->posts->page_config('$key')

Will return the rendered and optionally display the module content.

Returns

mixed  If return is TRUE, then it will return the output

Parameters

(boolean) $key 

$this->fuel->posts->find_module()

Will return the rendered and optionally display the module content.

Returns

mixed  If return is TRUE, then it will return the output

$this->fuel->posts->is_allowed()

Returns TRUE/FALSE as to whether a posts page should be displayed.

Returns

boolean

$this->fuel->posts->show_404()

Will either display a 404 error or will simply continue on to the view.

Returns

void

$this->fuel->posts->vars()

Variables to be merged in with the view.

Returns

string

$this->fuel->posts->get_order_by_field()

Returns the field to order by. Default will return "publish_date".

Returns

string

$this->fuel->posts->get_order_by_direction()

Returns the direction in which to order data. Default will return "desc".

Returns

string

$this->fuel->posts->get_slug_field()

Returns the slug field for the posts. Default will return "slug".

Returns

string

$this->fuel->posts->__call('$name', $args)

Convenience magic method if you want to drop the "get" from the method.

Returns

mixed

Parameters

(string) $name 
(array) $args