| Documentation | Working with posts

Working with posts

You can work with posts generated by panx-worker using Post Class.

List of functions:

  • setHeaders($headers) - Set headers files provided by $headers array. By default there are no headers.

  • setFooters($footers) - Set footers files provided by $headers array. By default there are no footers.

  • setSorting($sorting) - Set sorting of post by creation time. Use php constants SORT_DESC or SORT_ASC. By default is sorting set to SORT_DESC (From newest to oldest).

  • loadPost() - Load post provided by url (/post/{ID}, where {ID} is post name).

  • getTitle($post, $language = null) - Return title of post provided by $post (name of post). If the post does not exists, it returns Route::ERROR_NOT_FOUND.

  • listPosts($topic = null, $language = null) - Return array that contains all posts with specified $topic (If is set to null, use global topic). It will cache the result for 60 seconds. Example output:

  • deletePost($language = null) - Deletes the post specified by URL (Route::getValue("ID")).

  • loadInfo($post, $language = null) - Load info about post from .info file or return false.

If you set APP_MULTI_LANGUAGE_POSTS to true in .config, the post class will use multi language posts, e.g. the url will be /post/{LANGUAGE}/{ID} ...