LemonStand Documentation

Blog_Category class

The Blog_Category class represents a blog category. It contains fields for accessing a blog title title, description and posts.

Class fields

  • $name - category name
  • $url_name - URL name of the category, for example "news"
  • $description - a short description of the blog post in plain text format. Use the h() and nl2br() functions to output the description:
    <?= nl2br(h($category->description)) ?>
  • $published_post_num - number of published category posts
  • $posts - a list of published category posts. An instance of the Db_DataCollection class. Each element in the collection is an instance of the Blog_Post class.

Class methods

  • create() - creates an instance of the Blog_Category class.
  • find_all() - returns a collection of blog categories.
  • find($id) - finds a category by its identifier
  • find_by_code($api_code) - finds a category by its API code. Example:
    $category = Blog_Category::create()->find_by_code('news');

Next: Blog_Comment class
Previous: Blog_Post class
Return to Blog API

Comments

No comments posted so far.

Add your comment

Loading form...