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


PHP TPL::set_meta方法代码示例

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


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

示例1: index_action

 public function index_action()
 {
     if (!($page_info = $this->model('page')->get_page_by_url_token($_GET['id'])) or $page_info['enabled'] == 0) {
         HTTP::error_404();
     }
     if ($page_info['title']) {
         TPL::assign('page_title', $page_info['title']);
     }
     if ($page_info['keywords']) {
         TPL::set_meta('keywords', $page_info['keywords']);
     }
     if ($page_info['description']) {
         TPL::set_meta('description', $page_info['description']);
     }
     TPL::assign('page_info', $page_info);
     TPL::output('page/index');
 }
开发者ID:Gradven,项目名称:what3.1.7,代码行数:17,代码来源:main.php

示例2: index_action

 public function index_action()
 {
     if (is_digits($_GET['id'])) {
         if (!($topic_info = $this->model('topic')->get_topic_by_id($_GET['id']))) {
             $topic_info = $this->model('topic')->get_topic_by_title($_GET['id']);
         }
     } else {
         if (!($topic_info = $this->model('topic')->get_topic_by_title($_GET['id']))) {
             $topic_info = $this->model('topic')->get_topic_by_url_token($_GET['id']);
         }
     }
     if (!$topic_info) {
         H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/');
     }
     // if ($topic_info['merged_id'] AND $topic_info['merged_id'] != $topic_info['topic_id'])
     // {
     // 	if ($this->model('topic')->get_topic_by_id($topic_info['merged_id']))
     // 	{
     // 		HTTP::redirect('/topic/' . $topic_info['merged_id'] . '?rf=' . $topic_info['topic_id']);
     // 	}
     // 	else
     // 	{
     // 		$this->model('topic')->remove_merge_topic($topic_info['topic_id'], $topic_info['merged_id']);
     // 	}
     // }
     // if (urldecode($topic_info['url_token']) != $_GET['id'])
     // {
     // 	HTTP::redirect('/topic/' . $topic_info['url_token'] . '?rf=' . $_GET['rf']);
     // }
     // if (is_digits($_GET['rf']) and $_GET['rf'])
     // {
     // 	if ($from_topic = $this->model('topic')->get_topic_by_id($_GET['rf']))
     // 	{
     // 		$redirect_message[] = AWS_APP::lang()->_t('话题 (%s) 已与当前话题合并', $from_topic['topic_title']);
     // 	}
     // }
     if ($topic_info['seo_title']) {
         TPL::assign('page_title', $topic_info['seo_title']);
     } else {
         $this->crumb($topic_info['topic_title'], '/topic/' . $topic_info['url_token']);
     }
     if ($this->user_id) {
         $topic_info['has_focus'] = $this->model('topic')->has_focus_topic($this->user_id, $topic_info['topic_id']);
     }
     if ($topic_info['topic_description']) {
         TPL::set_meta('description', $topic_info['topic_title'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($topic_info['topic_description'])), 0, 128, 'UTF-8', '...'));
     }
     $topic_info['topic_description'] = nl2br(FORMAT::parse_bbcode($topic_info['topic_description']));
     //是否首页精选
     $topic_info['is_recommend_homepage'] = $this->model('recommend')->recommend_homepage_check('topic', $topic_info['topic_id']);
     TPL::assign('topic_info', $topic_info);
     // TPL::assign('best_answer_users', $this->model('topic')->get_best_answer_users_by_topic_id($topic_info['topic_id'], 5));
     switch ($topic_info['model_type']) {
         default:
             // $related_topics_ids = array();
             // if ($related_topics = $this->model('topic')->related_topics($topic_info['topic_id']))
             // {
             // 	foreach ($related_topics AS $key => $val)
             // 	{
             // 		$related_topics_ids[$val['topic_id']] = $val['topic_id'];
             // 	}
             // }
             // if ($child_topic_ids = $this->model('topic')->get_child_topic_ids($topic_info['topic_id']))
             // {
             // 	foreach ($child_topic_ids AS $key => $topic_id)
             // 	{
             // 		$related_topics_ids[$topic_id] = $topic_id;
             // 	}
             // }
             // TPL::assign('related_topics', $related_topics);
             // $log_list = ACTION_LOG::get_action_by_event_id($topic_info['topic_id'], 10, ACTION_LOG::CATEGORY_TOPIC, implode(',', array(
             // 	ACTION_LOG::ADD_TOPIC,
             // 	ACTION_LOG::MOD_TOPIC,
             // 	ACTION_LOG::MOD_TOPIC_DESCRI,
             // 	ACTION_LOG::MOD_TOPIC_PIC,
             // 	ACTION_LOG::DELETE_TOPIC,
             // 	ACTION_LOG::ADD_RELATED_TOPIC,
             // 	ACTION_LOG::DELETE_RELATED_TOPIC
             // )), -1);
             // $log_list = $this->model('topic')->analysis_log($log_list);
             // $contents_topic_id = $topic_info['topic_id'];
             // $contents_topic_title = $topic_info['topic_title'];
             // if ($merged_topics = $this->model('topic')->get_merged_topic_ids($topic_info['topic_id']))
             // {
             // 	foreach ($merged_topics AS $key => $val)
             // 	{
             // 		$merged_topic_ids[] = $val['source_id'];
             // 	}
             // 	$contents_topic_id .= ',' . implode(',', $merged_topic_ids);
             // 	if ($merged_topics_info = $this->model('topic')->get_topics_by_ids($merged_topic_ids))
             // 	{
             // 		foreach($merged_topics_info AS $key => $val)
             // 		{
             // 			$merged_topic_title[] = $val['topic_title'];
             // 		}
             // 	}
             // 	if ($merged_topic_title)
             // 	{
             // 		$contents_topic_title .= ',' . implode(',', $merged_topic_title);
             // 	}
//.........这里部分代码省略.........
开发者ID:egogg,项目名称:wecenter-dev,代码行数:101,代码来源:main.php

示例3: index_square_action

 public function index_square_action()
 {
     $this->crumb(AWS_APP::lang()->_t('问题'), '/question/');
     // 导航
     if (TPL::is_output('block/content_nav_menu.tpl.htm', 'question/square')) {
         TPL::assign('content_nav_menu', $this->model('menu')->get_nav_menu_list('question'));
     }
     //边栏可能感兴趣的人
     if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'question/square')) {
         TPL::assign('sidebar_recommend_users_topics', $this->model('module')->recommend_users_topics($this->user_id));
     }
     //边栏热门用户
     if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'question/square')) {
         TPL::assign('sidebar_hot_users', $this->model('module')->sidebar_hot_users($this->user_id, 5));
     }
     //边栏热门话题
     if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'question/square')) {
         TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($_GET['category']));
     }
     //边栏专题
     if (TPL::is_output('block/sidebar_feature.tpl.htm', 'question/square')) {
         TPL::assign('feature_list', $this->model('module')->feature_list());
     }
     if ($_GET['category']) {
         if (is_digits($_GET['category'])) {
             $category_info = $this->model('system')->get_category_info($_GET['category']);
         } else {
             $category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
         }
     }
     if ($category_info) {
         TPL::assign('category_info', $category_info);
         $this->crumb($category_info['title'], '/question/category-' . $category_info['id']);
         $meta_description = $category_info['title'];
         if ($category_info['description']) {
             $meta_description .= ' - ' . $category_info['description'];
         }
         TPL::set_meta('description', $meta_description);
     }
     if ($_GET['feature_id']) {
         $feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id']);
         TPL::assign('feature_info', $feature_info);
     }
     if ($feature_info['id']) {
         $topic_ids = $this->model('feature')->get_topics_by_feature_id($feature_info['id']);
     }
     if (!$_GET['sort_type']) {
         $_GET['sort_type'] = 'new';
     }
     if ($_GET['sort_type'] == 'hot') {
         $question_list = $this->model('posts')->get_hot_posts('question', $category_info['id'], $topic_ids, $_GET['day'], $_GET['page'], get_setting('contents_per_page'));
     } else {
         $question_list = $this->model('posts')->get_posts_list('question', $_GET['page'], get_setting('contents_per_page'), $_GET['sort_type'], $topic_ids, $category_info['id'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
     }
     if ($question_list) {
         foreach ($question_list as $key => $val) {
             if ($val['answer_count']) {
                 $question_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
             }
         }
     }
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/question/sort_type-' . preg_replace("/[\\(\\)\\.;']/", '', $_GET['sort_type']) . '__category-' . $category_info['id'] . '__day-' . intval($_GET['day']) . '__is_recommend-' . $_GET['is_recommend']) . '__feature_id-' . $feature_info['id'], 'total_rows' => $this->model('posts')->get_posts_list_total(), 'per_page' => get_setting('contents_per_page')))->create_links());
     TPL::assign('posts_list', $question_list);
     TPL::assign('question_list_bit', TPL::output('explore/ajax/list', false));
     TPL::output('question/square');
 }
开发者ID:egogg,项目名称:naokr-website,代码行数:66,代码来源:main.php

示例4: index_square_action

 public function index_square_action()
 {
     if (is_mobile()) {
         HTTP::redirect('/m/article/');
     }
     $this->crumb(AWS_APP::lang()->_t('文章'), '/article/');
     if ($_GET['category']) {
         if (is_digits($_GET['category'])) {
             $category_info = $this->model('system')->get_category_info($_GET['category']);
         } else {
             $category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
         }
     }
     if ($_GET['feature_id']) {
         $article_list = $this->model('article')->get_articles_list_by_topic_ids($_GET['page'], get_setting('contents_per_page'), 'add_time DESC', $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']));
         $article_list_total = $this->model('article')->article_list_total;
         if ($feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id'])) {
             $this->crumb($feature_info['title'], '/article/feature_id-' . $feature_info['id']);
             TPL::assign('feature_info', $feature_info);
         }
     } else {
         $article_list = $this->model('article')->get_articles_list($category_info['id'], $_GET['page'], get_setting('contents_per_page'), 'add_time DESC');
         $article_list_total = $this->model('article')->found_rows();
     }
     if ($article_list) {
         foreach ($article_list as $key => $val) {
             $article_ids[] = $val['id'];
             $article_uids[$val['uid']] = $val['uid'];
         }
         $article_topics = $this->model('topic')->get_topics_by_item_ids($article_ids, 'article');
         $article_users_info = $this->model('account')->get_user_info_by_uids($article_uids);
         foreach ($article_list as $key => $val) {
             $article_list[$key]['user_info'] = $article_users_info[$val['uid']];
         }
     }
     // 导航
     if (TPL::is_output('block/content_nav_menu.tpl.htm', 'article/square')) {
         TPL::assign('content_nav_menu', $this->model('menu')->get_nav_menu_list('article'));
     }
     //边栏热门话题
     if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'article/square')) {
         TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
     }
     if ($category_info) {
         TPL::assign('category_info', $category_info);
         $this->crumb($category_info['title'], '/article/category-' . $category_info['id']);
         $meta_description = $category_info['title'];
         if ($category_info['description']) {
             $meta_description .= ' - ' . $category_info['description'];
         }
         TPL::set_meta('description', $meta_description);
     }
     TPL::assign('article_list', $article_list);
     TPL::assign('article_topics', $article_topics);
     TPL::assign('hot_articles', $this->model('article')->get_articles_list(null, 1, 10, 'votes DESC'));
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/article/category_id-' . $_GET['category_id'] . '__feature_id-' . $_GET['feature_id']), 'total_rows' => $article_list_total, 'per_page' => get_setting('contents_per_page')))->create_links());
     TPL::output('article/square');
 }
开发者ID:chenruixuan,项目名称:wecenter,代码行数:58,代码来源:main.php

示例5: index_action

 public function index_action()
 {
     if (is_mobile()) {
         HTTP::redirect('/m/explore/' . $_GET['id']);
     }
     if ($this->user_id) {
         $this->crumb(AWS_APP::lang()->_t('发现'), '/question');
         if (!$this->user_info['email']) {
             HTTP::redirect('/account/complete_profile/');
         }
     }
     if ($_GET['category']) {
         if (is_digits($_GET['category'])) {
             $category_info = $this->model('system')->get_category_info($_GET['category']);
         } else {
             $category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
         }
     }
     if ($category_info) {
         TPL::assign('category_info', $category_info);
         $this->crumb($category_info['title'], '/category-' . $category_info['id']);
         $meta_description = $category_info['title'];
         if ($category_info['description']) {
             $meta_description .= ' - ' . $category_info['description'];
         }
         TPL::set_meta('description', $meta_description);
     }
     // 导航
     if (TPL::is_output('block/content_nav_menu.tpl.htm', 'explore/index')) {
         TPL::assign('content_nav_menu', $this->model('menu')->get_nav_menu_list('explore'));
     }
     // 边栏可能感兴趣的人
     if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'explore/index')) {
         if ($this->user_id) {
             TPL::assign('sidebar_recommend_users_topics', $this->model('module')->recommend_users_topics($this->user_id));
         }
     }
     // 边栏热门用户
     if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'explore/index')) {
         TPL::assign('sidebar_hot_users', $this->model('module')->sidebar_hot_users($this->user_id, 8));
     }
     // 边栏热门话题
     if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'explore/index')) {
         TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
     }
     // 边栏专题
     if (TPL::is_output('block/sidebar_feature.tpl.htm', 'explore/index')) {
         TPL::assign('feature_list', $this->model('module')->feature_list());
     }
     //最近所有热门
     if (TPL::is_output('block/near_hots_square.tpl.htm', 'explore/index')) {
         $posts_list = $this->model('posts')->get_hot_posts(null, $category_info['id'], null, $_GET['day'], $_GET['page'], 12);
         TPL::assign('near_posts_list', $posts_list);
     }
     if (!$_GET['sort_type'] and !$_GET['is_recommend']) {
         $_GET['sort_type'] = 'new';
     }
     if ($_GET['sort_type'] !== 'new' && isset($_GET['sort_type']) or isset($_GET['is_recommend'])) {
         Header("HTTP/1.1 301 Moved Permanently");
         $url = "/question" . $_SERVER[REQUEST_URI];
         HTTP::redirect($url);
     } else {
         $posts_list = $this->model('posts')->get_posts_list(null, $_GET['page'], get_setting('contents_per_page'), $_GET['sort_type'], null, $category_info['id'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
     }
     if ($posts_list) {
         foreach ($posts_list as $key => $val) {
             if ($val['answer_count']) {
                 $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
             }
         }
     }
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/sort_type-' . preg_replace("/[\\(\\)\\.;']/", '', $_GET['sort_type']) . '__category-' . $category_info['id'] . '__day-' . intval($_GET['day']) . '__is_recommend-' . intval($_GET['is_recommend'])), 'total_rows' => $this->model('posts')->get_posts_list_total(), 'per_page' => get_setting('contents_per_page')))->create_links());
     TPL::assign('posts_list', $posts_list);
     TPL::assign('posts_list_bit', TPL::output('explore/ajax/list', false));
     TPL::output('explore/index');
 }
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:76,代码来源:main.php

示例6: index_square_action

 public function index_square_action()
 {
     $this->crumb(AWS_APP::lang()->_t('知识'), '/article/');
     if ($_GET['category']) {
         if (is_digits($_GET['category'])) {
             $category_info = $this->model('system')->get_category_info($_GET['category']);
         } else {
             $category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
         }
     }
     if ($_GET['feature_id']) {
         $article_list = $this->model('article')->get_articles_list_by_topic_ids($_GET['page'], get_setting('contents_per_page'), 'add_time DESC', $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']));
         $article_list_total = $this->model('article')->article_list_total;
         if ($feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id'])) {
             $this->crumb($feature_info['title'], '/article/feature_id-' . $feature_info['id']);
             TPL::assign('feature_info', $feature_info);
         }
     } else {
         $article_list = $this->model('article')->get_articles_list($category_info['id'], $_GET['page'], get_setting('contents_per_page'), 'add_time DESC');
         $article_list_total = $this->model('article')->found_rows();
     }
     if ($article_list) {
         foreach ($article_list as $key => $val) {
             $article_ids[] = $val['id'];
             $article_uids[$val['uid']] = $val['uid'];
         }
         $article_topics = $this->model('topic')->get_topics_by_item_ids($article_ids, 'article');
         $article_users_info = $this->model('account')->get_user_info_by_uids($article_uids);
         // 获取文章缩略图
         $article_attachs = $this->model('publish')->get_attachs('article', $article_ids, 'min');
         foreach ($article_list as $key => $val) {
             $article_list[$key]['user_info'] = $article_users_info[$val['uid']];
             if ($val['has_attach']) {
                 $article_list[$key]['attachs'] = $article_attachs[$val['id']];
             }
             // 文章分类信息
             $article_list[$key]['category_info'] = $this->model('system')->get_category_info($val['category_id']);
         }
     }
     //边栏热门话题
     if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'article/square')) {
         TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
     }
     if ($category_info) {
         TPL::assign('category_info', $category_info);
         $this->crumb($category_info['title'], '/article/category-' . $category_info['id']);
         $meta_description = $category_info['title'];
         if ($category_info['description']) {
             $meta_description .= ' - ' . $category_info['description'];
         }
         TPL::set_meta('description', $meta_description);
     }
     TPL::assign('article_categories', $this->model('system')->fetch_category('article', 0));
     TPL::assign('article_list', $article_list);
     TPL::assign('article_topics', $article_topics);
     // 推荐文章
     TPL::assign('recommend_articles', $this->model('article')->get_recommend_article_list(null, 4));
     // 热门文章
     $hot_articles = $this->model('article')->get_articles_list(null, 1, 8, 'votes DESC', null);
     foreach ($hot_articles as $key => $val) {
         $article_ids[] = $val['id'];
     }
     $article_attachs = $this->model('publish')->get_attachs('article', $article_ids, 'min');
     foreach ($hot_articles as $key => $val) {
         $hot_articles[$key]['attachs'] = $article_attachs[$val['id']];
     }
     TPL::assign('hot_articles', $hot_articles);
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/article/category_id-' . $_GET['category_id'] . '__feature_id-' . $_GET['feature_id']), 'total_rows' => $article_list_total, 'per_page' => get_setting('contents_per_page')))->create_links());
     TPL::output('article/square');
 }
开发者ID:egogg,项目名称:wecenter-dev,代码行数:70,代码来源:main.php


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