Template and LifeType Object

Template and LifeType Object

出自LifeType 中文文件計畫

在2006年4月4日 (二) 11:55由Forlife (對話 | 貢獻)所做的修訂版本
(差異) ←上一修訂 | 當前修訂 (差異) | 下一修訂→ (差異)
跳轉到: 導航, 搜尋

How to create new template sets 當查看模版文件時, 你會發現類似: {$post->getTopic()}, {$calendar} 或是 {$utils->postPermalink($post)}的東西. 這些全都是輸出給模版使用的特殊物件. 以下是基本模版能使用的物件以及所有模版都能使用的物件的簡介:

main.template $posts: Array of posts with the posts for the front page. postandcomments.template $post: The post we're showing now. * $comments: An array of comments related to this post $prevpost: A post object representing the next post in the database, if any. $nextpost: Another post object representing now the previous post in the database, if any. commentarticle.template $post: The post we're going to comment on. posttrackbacks.template $post: The post from which we are getting the trackback information. $trackbacks: An array of trackback information objects representing the trackbacks received for this post. error.template $message: An string with the error message. searchresults.template tbd albums.template $albums $album resource.template $resource $albums The following template objects are available to all the templates:

$blog: An object containing information about the current blog, such as the name and description. $locale: Provides methods to translate strings based on the current locale. It also formats dates and numbers. $calendar: A string containing HTML code representing the calendar. It can be customized via CSS stylesheets. $archives: An array representing links to the archives. Each item represents a valid url pointing to the archives for that month. Archives are sorted chronologically, newest first, by months. $recentposts: An array of post objects that contains the most recent posts made in the blog. $articlecategories: An array of category objects with all the different categories availables. $mylinks: Cotains a list with all the links that have been set up for this blog. $utils: Provides commodity methods to generate urls and other information. $rss: An RSS aggregator. See PLog 1.0/How to use the RSS aggregator for more information on this object. Finally, it is also advisable to have a look at one of the template sets that comes with the main distribution of pLog.