本文整理汇总了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;
}