本文整理匯總了PHP中url::current_site方法的典型用法代碼示例。如果您正苦於以下問題:PHP url::current_site方法的具體用法?PHP url::current_site怎麽用?PHP url::current_site使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類url
的用法示例。
在下文中一共展示了url::current_site方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->head->link->append(url::current_site('feed'));
if (config::get('blog.enable_tagcloud') === 'yes') {
$tags = ORM::factory('blog_post')->tags();
if (!empty($tags)) {
Sidebar::instance()->add('Tagcloud', array('tags' => $tags));
}
}
}
示例2: comments
public function comments()
{
header('Content-Type: text/xml; charset=UTF-8', TRUE);
if ($cache = $this->cache->get('s7n_blog_feed_comments')) {
echo $cache;
return;
}
$comments = ORM::factory('blog_comment')->orderby('id', 'desc')->find_all(20);
$info = array('title' => config::get('s7n.site_title') . ' (Latest Comments)', 'link' => url::current_site(), 'generator' => 'S7Ncms - http://www.s7n.de/');
$items = array();
foreach ($comments as $comment) {
$items[] = array('author' => html::specialchars($comment->author), 'pubDate' => date('r', strtotime($comment->date)), 'title' => 'New comment for "' . $comment->blog_post->title . '"', 'description' => html::specialchars($comment->content), 'link' => $comment->blog_post->url(), 'guid' => $comment->blog_post->url());
}
$feed = feed::create($info, $items);
$this->cache->set('s7n_blog_feed_comments', $feed);
echo $feed;
}
示例3: tags
public function tags()
{
$tags = array();
$query = Database::instance()->select('tags')->get('blog_posts');
foreach ($query as $result) {
$exploded = explode(',', $result->tags);
foreach ($exploded as $tag) {
$tag = trim($tag);
if (empty($tag)) {
continue;
}
if (array_key_exists($tag, $tags)) {
$tags[$tag]++;
} else {
$tags[$tag] = 1;
}
}
}
$result = array();
foreach ($tags as $title => $count) {
$result[] = array('title' => $title, 'count' => $count, 'link' => url::current_site('tag/' . $title));
}
return $result;
}