当前位置: 首页>>代码示例>>PHP>>正文


PHP Meta::links方法代码示例

本文整理汇总了PHP中Meta::links方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::links方法的具体用法?PHP Meta::links怎么用?PHP Meta::links使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Meta的用法示例。


在下文中一共展示了Meta::links方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_view

 /**
  * List of pages (blogs/posts/etc.) with a specific tag
  *
  * @throws  HTTP_Exception_404
  *
  * @uses    Log::add
  * @uses    Text::ucfirst
  * @uses    ACL::check
  * @uses    Meta::links
  * @uses    URL::canonical
  * @uses    Route::url
  */
 public function action_view()
 {
     $id = (int) $this->request->param('id', 0);
     $tag = ORM::factory('tag', $id);
     if (!$tag->loaded()) {
         throw HTTP_Exception::factory(404, 'Tag :tag not found!', array(':tag' => $id));
     }
     $this->title = __(':title', array(':title' => Text::ucfirst($tag->name)));
     $view = View::factory('tag/view')->set('teaser', TRUE)->bind('pagination', $pagination)->bind('posts', $posts);
     $posts = $tag->posts;
     if (!ACL::check('administer tags') and !ACL::check('administer content')) {
         $posts->where('status', '=', 'publish');
     }
     $total = $posts->reset(FALSE)->count_all();
     if ($total == 0) {
         Log::info('No posts found.');
         $this->response->body(View::factory('page/none'));
         return;
     }
     $pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => 15, 'uri' => $tag->url));
     $posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     $this->response->body($view);
     // Set the canonical and shortlink for search engines
     if ($this->auto_render === TRUE) {
         Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical'));
         Meta::links(Route::url('tag', array('action' => 'view', 'id' => $tag->id)), array('rel' => 'shortlink'));
     }
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:40,代码来源:tag.php

示例2:

<!DOCTYPE html>
<html lang="<?php 
echo $lang;
?>
">
<head>
	<title><?php 
echo $head_title;
?>
</title>
	<?php 
echo Meta::tags();
?>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<?php 
echo Meta::links();
?>
	<?php 
echo Assets::css();
?>
	<link href='//fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
	<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
	<!--[if lt IE 9]>
		<?php 
echo HTML::script('media/js/html5shiv.js', NULL, TRUE);
?>
		<?php 
echo HTML::script('media/js/respond.min.js', NULL, TRUE);
?>
    <![endif]-->
开发者ID:MenZil-Team,项目名称:cms,代码行数:31,代码来源:welcome.php

示例3: action_tag

 /**
  * Tags view
  *
  * @throw HTTP_Exception_404
  */
 public function action_tag()
 {
     $config = Config::load('blog');
     $id = (int) $this->request->param('id', 0);
     $tag = ORM::factory('tag', array('id' => $id, 'type' => 'blog'));
     if (!$tag->loaded()) {
         throw HTTP_Exception::factory(404, 'Tag ":tag" Not Found', array(':tag' => $id));
     }
     $this->title = __(':title', array(':title' => Text::ucfirst($tag->name)));
     $view = View::factory('blog/list')->set('teaser', TRUE)->set('config', $config)->bind('rss_link', $rss_link)->bind('pagination', $pagination)->bind('posts', $posts);
     $posts = $tag->posts;
     if (!ACL::check('administer tags') and !ACL::check('administer content')) {
         $posts->where('status', '=', 'publish');
     }
     $total = $posts->reset(FALSE)->count_all();
     if ($total == 0) {
         Log::info('No blogs found.');
         $this->response->body(View::factory('blog/none'));
         return;
     }
     $rss_link = Route::get('rss')->uri(array('controller' => 'blog', 'action' => 'tag', 'id' => $tag->id));
     $pagination = Pagination::factory(array('current_page' => array('source' => 'cms', 'key' => 'page'), 'total_items' => $total, 'items_per_page' => $config->get('items_per_page', 15), 'uri' => $tag->url));
     $posts = $posts->order_by('created', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     $this->response->body($view);
     // Set the canonical and shortlink for search engines
     if ($this->auto_render) {
         Meta::links(URL::canonical($tag->url, $pagination), array('rel' => 'canonical'));
         Meta::links(Route::url('blog', array('action' => 'tag', 'id' => $tag->id), TRUE), array('rel' => 'shortlink'));
         Meta::links(Route::url('rss', array('controller' => 'blog', 'action' => 'tag', 'id' => $tag->id), TRUE), array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => Template::getSiteName() . ' : ' . $tag->name));
     }
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:36,代码来源:blog.php

示例4: _set_default_meta_links

 /**
  * Set the default meta links
  *
  * Used configuration settings.
  *
  * @uses    Meta::links
  * @uses    Arr::get
  */
 protected function _set_default_meta_links()
 {
     $meta = $this->_config->get('meta', array());
     $links = Arr::get($meta, 'links');
     if ($links) {
         foreach ($links as $url => $attributes) {
             Meta::links($url, $attributes);
         }
     }
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:18,代码来源:template.php

示例5: remove_links

 /**
  * Remove a Meta Link, or all
  *
  * @param   mixed  $handle  Asset name, or NULL to remove all [Optional]
  *
  * @return  mixed  Empty array or void
  */
 public static function remove_links($handle = NULL)
 {
     if (is_null($handle)) {
         return self::$links = array();
     }
     unset(self::$links[$handle]);
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:14,代码来源:meta.php


注:本文中的Meta::links方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。