Model Object Reference
From pixyWiki
This section covers the standard model objects available in all page templates. For each model, we'll cover properties and methods.
Contents |
$config
The $config model provides access to the pixyBlog configuration data that you'll need in your website.
$config Properties
| Name | Type | Description |
|---|---|---|
| $config.commentAutoFormat | boolean | true if comments should be formatted with added line feeds. |
| $config.commentEmailNotify | boolean | true if notification of new comments via email is enabled. |
| $config.commentEscapeHtml | boolean | true if all HTML will be stripped of comments before display. |
| $config.feedMaxSize | int | Maximum number of items displayed in RSS and Atom feeds. |
| $config.feedStyle | boolean | true if feeds are displayed with user-friendly formatting (via XSL stylesheet). |
| $config.pixyVersion | String | Version number of pixyBlog build. |
| $config.registrationEnabled | boolean | true if new user registration is enabled. |
| $config.registrationURL | String | URL of new user registration site. |
| $config.siteDescription | String | Description of the pixyBlog site. |
| $config.siteEmail | String | Email address of this pixyBlog site administrator. |
| $config.siteName | String | Name of the pixyBlog site. |
| $config.siteShortName | String | Short name of the pixyBlog site. |
$config Methods
The $config model also provides a set of methods for accessing properties by name. Generally, you should be able to get the configuration data you need from the properties above. You shouldn't need to call these methods, but just so you know:
- boolean getBooleanProperty(String propertyName) - Returns the named runtime property as a booean.
- String getProperty(String propertyName) - Returns the named runtime property as a String.
- int getIntProperty(String propertyName) - Returns the named runtime property as an integer.
$model
The $model object provides you with access to all of the data objects that make up your website. You can get a pager object to access your website entries, the website entry referenced by the request, the gallery object referenced by the request and the website itself.
The diagram below show the objects you can get from the $model and the collections of objects that you can get from those.
>>> INSERT IMAGE <<<
Now let's the details of the $model object, starting with properties.
$model Properties
| Name | Type | Description |
|---|---|---|
| $model.commentForm | CommentForm | On a comment-page, this object will be populated with the comment form values. Values available are $model.commentForm.name, $model.commentForm.url and $model.commenForm.content. |
| $model.locale | String | Name of locale if one is specified in the URL. |
| $model.weblog | Website | Current website being displayed. |
| $model.weblogGallery | Gallery | Website gallery specified by URL or null if not specified. |
| $model.weblogEntry | Entry | Website entry object specified by URL or null if none specified. |
| $model.weblogEntriesPager | Pager | Website entry pager for paging over entries specified by URL. |
| $model.weblogPage | PageTemplate | Website page object specified or implied by URL. |
| $model.permalink | boolean | True if URL specifies one specific Entry permalink. |
| $model.searchResults | boolean | True if displaying search results. |
$model Search Properties
If the URL indicates a search, then the pager returned by $model.weblogEntriesPager will return entries from the search and some additional properties will be available on the $model object:
| Name | Type | Description |
|---|---|---|
| $model.galleries | List of Strings | List of gallery names available in search. |
| $model.hits | int | Total number of hits found. |
| $model.limit | int | Max. number of search results displayed per page. |
| $model.offset | int | Offset into current page of search results. |
| $model.weblogSpecificSearch | boolean | True if search is specific to one website. |
$model methods
The $model object also provides a couple of methods:
- Pager getWeblogEntriesPager(String galPath, int numEntries) - Returns a pager with the specified number of entries and which contains only entries from the specified gallery.
- Pager getWeblogEntriesPager(String catPath) - Returns a pager that contains only entries from the specified gallery.
- String getRequestParameter(String paramName) - Returns a specific request parameter from the URL.
- Pager getCommentsPager(int sinceDays, int numEntries) - Returns a pager with the specified number of comments and which contains only comments posted from the specified number of days.
$url
To ensure that your URLs are formed correctly, you should use the $url model to form all URLs that point to the pixyBlog site or to your website. Every possible type of pixyBlog URL is supported:
| Name | Type | Description |
|---|---|---|
| $url.absoluteSite | String | Absolute URL of website. |
| $url.gallery(String galPath) | String | URL for one gallery within website. |
| $url.gallery(String galPath, String pageLink) | String | URL for one gallery within website on the specified page. |
| $url.gallery(String galPath, int pageNum) | String | URL for one gallery within website, w/page. |
| $url.commentAuthenticator | String | URL of comment authenticator. |
| $url.comment(String anchor, String timeStamp) | String | URL of comment for entry specified by anchor. |
| $url.comments(String anchor) | String | URL of comments for entry specified by anchor. |
| $url.createEntry | String | URL for new-entry page in pixyBlog UI. |
| $url.editEntry(String anchor) | String | URL for edit-single-entry page in pixyBlog UI. |
| $url.date(String dateString) | String | URL for one specific 6 or 8 character date. |
| $url.date(String dateString, int pageNum) | String | URL for one specific 6 or 8 character date, w/page. |
| $url.editSettings | String | URL for edit-website-settings page in pixyBlog UI. |
| $url.entry(String anchor) | String | URL for entry specified by anchor. |
| $url.feed.entries.atom | String | URL of entries feed (Atom). |
| $url.feed.entries.rss | String | URL of entries feed (RSS). |
| $url.feed.comments.atom | String | URL of comments feed (Atom). |
| $url.feed.comments.rss | String | URL of comments feed (RSS). |
| $url.home | String | URL of website. |
| $url.home(String locale) | String | URL to access website in one specific language. |
| $url.home(String locale, int pageNum) | String | URL to access website in one specific language, with paging. |
| $url.login | String | URL of login page. |
| $url.logout | String | URL of logout page. |
| $url.rsd | String | URL of Really Simple Discovery (RSD) service. |
| $url.page(String pageLink) | String | URL of page specified by pageLink. |
| $url.page(String pageLink, String dateString, String catPath, int pageNum) | String | URL of page specified by pageLink, dateString, catPath and pageNum. |
| $url.photo(String photoPath) | String | URL of photo specified by the path. |
| $url.search | String | URL of search. |
| $url.search(String query, String catPath, int pageNum) | String | URL of search for specific search string, catPath and pageNum. |
| $url.site | String | Relative URL of pixyBlog site. |
| $url.resource(String filePath) | String | URL of uploaded file resource in website. |
| $url.themeResource(String theme, String file) | String | URL of a resource within a pixyBlog theme. |
| $url.themeResource(String theme, String file, boolean abs) | String | Absolute URL of a resource within a pixyBlog theme. |
| $url.tag(String tag) | String | URL to specified tag. |
| $url.tag(String tagname, String pagelink) | String | URL to specified tag on the the page specified by 'pagelink'. |
| $url.trackback(String anchor) | String | Trackback URL for entry specified by anchor. |
$utils
The $utils object provides all of the string manipulation methods you'll ever need for your website, including methods for formatting dates, escaping HTML, encoding URLs and even removing HTML entirely. Here's a comprehensive list of the $utils methods:
| Name | Type | Description |
|---|---|---|
| $utils.addNowFollow(String s) | String | Adds the nofollow attribute to any HTML links found within the string. |
| $utils.autoformat(String s) | String | Converts any line-breaks in the string with <br> tags. |
| $utils.decode(String s) | String | Decodes a string that has been URL encoded. |
| $utils.encode(String s) | String | Applies URL encoding to a string. |
| $utils.escapeHTML(String s) | String | Escapes any non-HTML characters found in the string. |
| $utils.escapeXML(String s) | String | Escapes any non-XML compatible characters found in the string. |
| $utils.escapeJavascript(String s) | String | Escapes any non-Javascript compatible characters found in the string. |
| $utils.formatDate(Date date, String fmt) | String | Formats a date object according to the format specified (see Date Formatting) |
| $utils.formatIso8601Date(Date date) | String | Formats a date object using ISO-8601 date formatting. |
| $utils.formatRfc822Date(Data date) | String | Formats a date object using RFC-822 date formatting. |
| $utils.isEmpty(Object o) | boolean | Returns true if the object is null or if it is an empty string. |
| $utils.IsNotEmpty(Object o) | boolean | Returns true of the object is not null or is a non-empty string. |
| $utils.isLongAspectRatio(int width, int height, String minRatio) | boolean | Returns true if the width/height ratio is greater than the given minRatio. |
| $utils.removeHTML(String s) | String | Remove all HTML markup from a string. |
| $utils.replace(String str, String target, String replacement) | String | In the string str, replace the target string with the replacement string. |
| $utils.toBase64(String s) | String | Convert a string to Base64 encoding. |
| $utils.transformToHTMLSubset(String s) | String | Transform any HTML in the string to a safe HTML subset. |
| $utils.truncate(String str, int lower, int upper, String append) | String | Truncate a string str so that it is between lower and upper characters in length and add the append string. |
| $utils.unescapeHTML(String s) | String | Unscape a string that has been HTML escaped. |
| $utils.unescapeXML(String s) | String | Unescape a string that has been XML escaped. |
| $utils.unescapeJavascript(String s) | String | Unescape a string that has been Javascript escaped. |

