Template and LifeType Object |
出自LifeType 中文文件計畫
第1行: | 第1行: | ||
[http://wiki.lifetype.net/index.php/Template_Development How to create new template sets ] | [http://wiki.lifetype.net/index.php/Template_Development How to create new template sets ] | ||
+ | |||
當查看模版文件時, 你會發現類似: {$post->getTopic()}, {$calendar} 或是 {$utils->postPermalink($post)}的東西. 這些全都是輸出給模版使用的特殊物件. 以下是基本模版能使用的物件以及所有模版都能使用的物件的簡介: | 當查看模版文件時, 你會發現類似: {$post->getTopic()}, {$calendar} 或是 {$utils->postPermalink($post)}的東西. 這些全都是輸出給模版使用的特殊物件. 以下是基本模版能使用的物件以及所有模版都能使用的物件的簡介: | ||
+ | 以下對基本模版有效的模版物件: | ||
main.template | main.template | ||
- | $posts: | + | $posts: 首頁所使用文章的陣列. |
postandcomments.template | postandcomments.template | ||
- | $post: | + | $post: 當前顯示的文章. * $comments: 當前文章的評論的陣列(comments) |
- | $prevpost: A post object representing the next post in the database, if any. | + | $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. | + | $nextpost: 下一篇文章的物件, 如果存在(原文: Another post object representing now the previous post in the database, if any). |
commentarticle.template | commentarticle.template | ||
- | $post: | + | $post: 正在評論(comment on)的文章. |
posttrackbacks.template | posttrackbacks.template | ||
- | $post: | + | $post: 正在獲取trackback的文章. |
- | $trackbacks: | + | $trackbacks: 當前文章的trackbacks的物件陣列. |
error.template | error.template | ||
- | $message: | + | $message: 一條錯誤訊息的字符串(String). |
searchresults.template | searchresults.template | ||
tbd | tbd | ||
第23行: | 第25行: | ||
$resource | $resource | ||
$albums | $albums | ||
- | + | ||
+ | 以下是對所有模版有效的模版物件: | ||
$blog: An object containing information about the current blog, such as the name and description. | $blog: An object containing information about the current blog, such as the name and description. |
在2006年4月4日 (二) 12:03所做的修訂版本
How to create new template sets
當查看模版文件時, 你會發現類似: {$post->getTopic()}, {$calendar} 或是 {$utils->postPermalink($post)}的東西. 這些全都是輸出給模版使用的特殊物件. 以下是基本模版能使用的物件以及所有模版都能使用的物件的簡介:
以下對基本模版有效的模版物件: main.template $posts: 首頁所使用文章的陣列. postandcomments.template $post: 當前顯示的文章. * $comments: 當前文章的評論的陣列(comments) $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: 正在評論(comment on)的文章. posttrackbacks.template $post: 正在獲取trackback的文章. $trackbacks: 當前文章的trackbacks的物件陣列. error.template $message: 一條錯誤訊息的字符串(String). searchresults.template tbd albums.template $albums $album resource.template $resource $albums
以下是對所有模版有效的模版物件:
$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.