New version 0.9 has been released! Jun 16, 2015
×

Article module

Description

Article module helps you to create live editable articles with categories on frontend.


Include

use yii\easyii\modules\article\api\Article;


Public functions

object Article::cat( $id_slug )
$id_slug integer / string Category identifier can be integer (id) or string (slug)
Returns CategoryObject or null if not found.

array Article::tree()
Returns array of categories in tree structure.

array Article::cats()
Returns array of categories in flat structure.

array Article::items( $options = [] )
$options array
  • where (mixed) - additional condition, details
  • tags (mixed) - search by tag, can be string or array
  • pagination (array) - properties for Pagination object.
Returns array of ArticleObject

object Article::get( $id_slug )
$id_slug mixed Article identifier can be integer (id) or string (slug
Returns ArticleObject or null if not found.

array Article::last( $limit = 1, $where = [] )
$limit integer Count of last photos
$where mixed additional condition, details
Returns array of ArticleObject

string Article::plugin()
Apply Fancybox plugin on all photos, called as box() function.

string Article::pages()
Returns pagination html generated by yii\widgets\LinkPager widget.

object Article::pagination()
Returns yii\data\Pagination object.

CategoryObject

Public Properties

$title string Category title
$slug string Category slug
$image string Path to image attached to category
$model yii\db\ActiveRecord Category ActiveRecord object

Public Functions

string thumb( $width, $height = null, $crop = true )
$width int Thumbnail width
$height int Thumbnail height
$crop boolean Crop or resize image to thumbnail sizes
Returns path to image thumbnail

Public Functions

array items( $options = [] )
$options array
  • where (mixed) - additional condition, details
  • tags (mixed) - search by tag, can be string or array
  • pagination (array) - properties for Pagination object.
Returns array of ArticleObject

string pages()
Returns pagination html generated by yii\widgets\LinkPager widget.

object pagination()
Returns yii\data\Pagination object.


ArticleObject

Public Properties

$title string Article title
$short string Article short text
$text string Article full text
$slug string Article slug
$category_id integer Item category id
$cat object Article category
$tags array List of tags
$image string Path to image attached to article
$photos array Array of PhotoObject
$views int Count of article views
$time int Article create unix time
$date string Article create formatted date
$model yii\db\ActiveRecord Article ActiveRecord object

Public Functions

string thumb( $width, $height = null, $crop = true )
$width int Thumbnail width
$height int Thumbnail height
$crop boolean Crop or resize image to thumbnail sizes
Returns path to image thumbnail


PhotoObject

Public Properties

$image string Path to image
$description string Photo description

Public Functions

string box( $width, $height )
$width int Thumbnail width
$height int Thumbnail height
Returns Fancybox scripted image thumbnail