Skip to content

Object Attributes

Daniel Pimley edited this page Oct 4, 2023 · 9 revisions

Chyrp Lite's Model class provides a powerful data model for objects that are constructed using SQL data. Below is a list of attributes for Post, Page, User, Group, Category, View, Like, Pingback, and Comment objects. These attributes are accessible from PHP using the -> operator and from Twig using the . operator.

Post

Attribute Requires Description
no_results true if the object represents a database query that returned nothing.
feather Name of the feather responsible for rendering this blog post.
id Numeric ID for this blog post.
created_at Timestamp for the creation of this blog post.
updated true if the post has been updated.
updated_at Timestamp for the most recent update of this blog post.
url The unique URL identifier (slug) for this blog post.
slug Synonym for url.
previous The previous blog post in chronological order.
next The next blog post in chronological order.
user The user who created this post.
category Categorize The category this post belongs to.
views Post Views The view count for this post.
likes Likes An array of likes added to this post.
like_count Likes A count of the likes added to this post.
like_link Likes HTML fragment for a like/unlike link.
pingbacks Mentionable An array of webmentions to this post.
pingback_count Mentionable A count of the webmentions for this post.
comments Comments An array of comments on this post.
comment_count Comments A count of the comments for this post.
latest_comment Comments The timestamp of the latest comment on this post.
commentable Comments true if the current visitor can comment on this post.

Page

Attribute Requires Description
no_results true if the object represents a database query that returned nothing.
id Unique identifier for this page.
created_at Timestamp for the creation of this page.
updated true if the page has been updated.
updated_at Timestamp for the most recent update of this page.
url The unique URL identifier (slug) for this page.
slug Synonym for url.
title Title of this page.
public Can the page be viewed without permission?
show_in_list Should this page be included in the pages list?
children An array of pages that are children of this page.
parent The parent page of this page.
user The user who created this page.

User

Attribute Requires Description
no_results true if the object represents a database query that returned nothing.
group The group this user belongs to.
posts An array of posts created by this user.
pages An array of pages created by this user.
likes Likes An array of likes added by this user.
like_count Likes A count of the likes added by this user.
views Post Views An array of post viewings by this user.
view_count Post Views A count of post viewings by this user.
comments Comments An array of comments made by this user.
comment_count Comments A count of the comments made by this user.

Visitor

Attribute Requires Description
id The numeric ID of this user - zero if not logged in.
logged in true if the visitor is logged in.
likes Likes An array of likes added by this visitor.
like_count Likes A count of the likes added by this visitor.
comments Comments An array of comments made by this visitor.
comment_count Comments A count of the comments made by this visitor.

Group

Attribute Requires Description
no_results true if the object represents a database query that returned nothing.
users An array of users belonging to this group.

Category

Attribute Requires Description
no_results Categorize true if the object represents a database query that returned nothing.
id Categorize The numeric ID of this category.
name Categorize The category name.
clean Categorize The URL-friendly name.
show_on_home Categorize true if the category can be listed on the homepage.
url Categorize The absolute URL[note] for this category listing.
post_count Categorize The number of posts belonging to this category.

View

Attribute Requires Description
no_results Post Views true if the object represents a database query that returned nothing.
id Post Views The numeric ID of this view.
post_id Post Views The ID of the post that was viewed.
user_id Post Views The ID of the user who viewed the post - zero if not logged in.
created_at Post Views Timestamp for the viewing.

Like

Attribute Requires Description
no_results Likes true if the object represents a database query that returned nothing.
id Likes The numeric ID of this like.
post_id Likes The ID of the post that was liked.
user_id Likes The ID of the user who liked the post - zero if not logged in.
timestamp Likes Timestamp when the post was liked.
session_hash Likes A hash identifying this user and session combination.

Pingback

Attribute Requires Description
no_results Mentionable true if the object represents a database query that returned nothing.
id Mentionable The numeric ID of this webmention.
post_id Mentionable The ID of the post that was mentioned.
source Mentionable The URL of the source that mentioned the post.
title Mentionable A title identifying the source.
created_at Mentionable Timestamp for the creation of this webmention.

Comment

Attribute Requires Description
no_results Comments true if the object represents a database query that returned nothing.
id Comments The numeric ID of this comment.
body Comments The comment text.
author Comments The name of this comment's author.
author_url Comments The URL of this comment's author.
author_email Comments The email address of the author.
ip Comments CRC-24 hash of the commenter's IP address.
agent Comments User agent string from the commenter's browser.
status Comments Status of the comment: approved, denied, spam, or pingback.
post_id Comments The ID of the post that was mentioned.
user_id Comments The ID of the user who commented - zero if not logged in.
created_at Comments Timestamp for the creation of this comment.
updated true if the comment has been updated.
updated_at Comments Timestamp for the most recent update of this comment.
Clone this wiki locally