Browse Source

add nickname support

master
filesite 7 months ago
parent
commit
0173ac4984
  1. 8
      themes/tajian/controller/ListController.php
  2. 23
      themes/tajian/controller/SiteController.php
  3. 3
      themes/tajian/views/layout/main.php

8
themes/tajian/controller/ListController.php

@ -58,6 +58,9 @@ Class ListController extends SiteController {
} }
} }
//昵称支持
$nickname = $this->getNickname($readmeFile);
$pageTitle = $defaultTitle = !empty($titles) ? $titles[0]['name'] : FSC::$app['config']['site_name']; $pageTitle = $defaultTitle = !empty($titles) ? $titles[0]['name'] : FSC::$app['config']['site_name'];
if (!empty($tagItem)) { if (!empty($tagItem)) {
$pageTitle = "{$tagItem['name']}精选视频,来自{$defaultTitle}"; $pageTitle = "{$tagItem['name']}精选视频,来自{$defaultTitle}";
@ -66,7 +69,10 @@ Class ListController extends SiteController {
} }
} }
$viewName = '//site/index'; //共享视图 $viewName = '//site/index'; //共享视图
$params = compact('cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', 'tags'); $params = compact(
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme',
'breadcrumbs', 'htmlCateReadme', 'tags', 'nickname'
);
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }

23
themes/tajian/controller/SiteController.php

@ -59,6 +59,8 @@ Class SiteController extends Controller {
$tags = $this->sortTags($menus_sorted, $tags); $tags = $this->sortTags($menus_sorted, $tags);
} }
//昵称支持
$nickname = $this->getNickname($readmeFile);
$pageTitle = $defaultTitle = !empty($titles) ? $titles[0]['name'] : FSC::$app['config']['site_name']; $pageTitle = $defaultTitle = !empty($titles) ? $titles[0]['name'] : FSC::$app['config']['site_name'];
if (!empty($readmeFile['title'])) { if (!empty($readmeFile['title'])) {
@ -66,7 +68,10 @@ Class SiteController extends Controller {
} }
$viewName = 'index'; $viewName = 'index';
$params = compact('cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'tags'); $params = compact(
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'tags',
'nickname'
);
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }
@ -127,6 +132,18 @@ Class SiteController extends Controller {
return $sorted_tags; return $sorted_tags;
} }
protected function getNickname($readmeFile) {
$nickname = '';
if (!empty($readmeFile['nickname'])) {
$nickname = $readmeFile['nickname'];
}else if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['user_id'])) {
$nickname = FSC::$app['user_id'];
}
return $nickname;
}
//添加新视频 //添加新视频
public function actionNew() { public function actionNew() {
//获取数据 //获取数据
@ -164,10 +181,12 @@ Class SiteController extends Controller {
$tags = $this->sortTags($menus_sorted, $tags); $tags = $this->sortTags($menus_sorted, $tags);
} }
//昵称支持
$nickname = $this->getNickname($readmeFile);
$pageTitle = '添加视频收藏'; $pageTitle = '添加视频收藏';
$viewName = 'new'; $viewName = 'new';
$params = compact('dirTree', 'scanResults', 'htmlReadme', 'tags'); $params = compact('dirTree', 'scanResults', 'htmlReadme', 'tags', 'nickname');
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }

3
themes/tajian/views/layout/main.php

@ -22,6 +22,9 @@ if (!empty(FSC::$app['config']['multipleUserUriParse']) && !empty(FSC::$app['use
<header class="top_nav"> <header class="top_nav">
<a class="log_tn clearfix" href=""> <a class="log_tn clearfix" href="">
<span class="verMiddle">Ta荐</span> <span class="verMiddle">Ta荐</span>
<?php if (!empty($viewData['nickname'])) { ?>
- <strong><?=$viewData['nickname']?></strong>
<?php } ?>
</a> </a>
<div class="search hide_movi_xs hide"> <div class="search hide_movi_xs hide">
<form id="search_form" class="search_form" action="" method="GET"> <form id="search_form" class="search_form" action="" method="GET">

Loading…
Cancel
Save