[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载

2019-05-17 0 456

TiNav 2.0(钛导航)网址导航网站主题是由运营狗开发的Typecho主题,目前已停止开源,下面分享的为最终版本。
[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载

更新内容:

1、导航增加二级分类显示
2、首页增加友情链接(请安装links插件,不安装首页则不显示友情链接,不影响使用)
3、保留了原主题的搜索功能、前台登录、留言页面(使用留言功能请新建view.html独立页面)
4、PC端与移动端导航栏分别加载不同的链接,PC端为锚文本链接,移动端为分类栏目链接
5、自定义字段不显示的小伙伴,请注意PHP版本,演示站为5.5版本

TiNav主题使用方法

上传到typecho主题文件夹即可(使用过1.0版本的,可以直接覆盖使用;但本屌建议重装typecho,因为之前修改过系统文件)

文章页面

[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载
主题安装完成,在撰写文章页面填入跳转URL、描述、LOGO。

导航创建

关于导航栏的创建,只要新建分类即可
导航栏标题前面的图标请在分类缩略名中填入,图标样式请参考http://fontawesome.dashgame.com/
[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载

PHP7使用方法

由于Typecho中某些自定义字段不支持PHP7版本,所以这次在2.0最终版的基础上更新PHP7版本,安装方法较复杂,不建议小白使用。
如果网站LOGO还是无法使用,请在sidebar中写入绝对链接,懒得修改了。
本主题涉及到修改Typecho系统文件和数据库,注意备份,建议看完本文再操作,莫着急。

1、下载主题,上传到typecho主题文件夹;

2、在Typecho数据库文章表中添加新字段

在数据表 typecho_contents 中新建一个 test_url、test_word、test_img 三个字段,类型可为字符串;

[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载

3、修改Typecho系统文件(不爱动手的小伙伴可以下载下面修改好的系统文件,直接覆盖。)

点击下载

直接覆盖的小伙伴请忽略下面的步骤,直接跳到 创建导航栏

①后台模板文件 admin/write-post.php 表单中(大概在第21行后面)插入:
[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载
②在 var/Widget/Contents/Post/Edit.php 里的 writePost 函数里需要接收新字段参数:

public function writePost()
    {
        $contents = $this->request->from('password', 'allowComment',
            'allowPing', 'allowFeed', 'slug', 'tags', 'text', 'visibility', 'test_url', 'test_word', 'test_img');

③在 var/Widget/Abstract/Contents.php 里的三个函数添加新参数:

在 insert 函数添加新参数:

/**
     * 插入内容
     *
     *
    public function insert(array $content)
    {
        /** 构建插入结构 */
        $insertStruct = array(
            'title'         =>  empty($content['title']) ? NULL : htmlspecialchars($content['title']),
            'created'       =>  empty($content['created']) ? $this->options->time : $content['created'],
            'modified'      =>  $this->options->time,
            'text'          =>  empty($content['text']) ? NULL : $content['text'],
            'order'         =>  empty($content['order']) ? 0 : intval($content['order']),
            'authorId'      =>  isset($content['authorId']) ? $content['authorId'] : $this->user->uid,
            'template'      =>  empty($content['template']) ? NULL : $content['template'],
            'type'          =>  empty($content['type']) ? 'post' : $content['type'],
            'status'        =>  empty($content['status']) ? 'publish' : $content['status'],
            'password'      =>  empty($content['password']) ? NULL : $content['password'],
            'commentsNum'   =>  empty($content['commentsNum']) ? 0 : $content['commentsNum'],
            'allowComment'  =>  !empty($content['allowComment']) && 1 == $content['allowComment'] ? 1 : 0,
            'allowPing'     =>  !empty($content['allowPing']) && 1 == $content['allowPing'] ? 1 : 0,
            'allowFeed'     =>  !empty($content['allowFeed']) && 1 == $content['allowFeed'] ? 1 : 0,
            'parent'        =>  empty($content['parent']) ? 0 : intval($content['parent']),
            'test_url'         =>  empty($content['test_url']) ? NULL : $content['test_url'],
            'test_word'         =>  empty($content['test_word']) ? NULL : $content['test_word'],
            'test_img'         =>  empty($content['test_img']) ? NULL : $content['test_img']
        );

在 update 函数里构建更新结构加入新字段:

public function update(array $content, Typecho_Db_Query $condition)
    {
        /** 首先验证写入权限 */
        if (!$this->isWriteable(clone $condition)) {
            return false;
        }

        /** 构建更新结构 */
        $preUpdateStruct = array(
            'title'         =>  empty($content['title']) ? NULL : htmlspecialchars($content['title']),
            'order'         =>  empty($content['order']) ? 0 : intval($content['order']),
            'text'          =>  empty($content['text']) ? NULL : $content['text'],
            'template'      =>  empty($content['template']) ? NULL : $content['template'],
            'type'          =>  empty($content['type']) ? 'post' : $content['type'],
            'status'        =>  empty($content['status']) ? 'publish' : $content['status'],
            'password'      =>  empty($content['password']) ? NULL : $content['password'],
            'allowComment'  =>  !empty($content['allowComment']) && 1 == $content['allowComment'] ? 1 : 0,
            'allowPing'     =>  !empty($content['allowPing']) && 1 == $content['allowPing'] ? 1 : 0,
            'allowFeed'     =>  !empty($content['allowFeed']) && 1 == $content['allowFeed'] ? 1 : 0,
            'parent'        =>  empty($content['parent']) ? 0 : intval($content['parent']),
            'test_url'      =>  empty($content['test_url']) ? NULL : $content['test_url'],
            'test_word'     =>  empty($content['test_word']) ? NULL : $content['test_word'],
            'test_img'      =>  empty($content['test_img']) ? NULL : $content['test_img']
        );

在 select 函数里添加查询新字段:

/**
* 获取查询对象
*
*
public function select()
{
    return $this->db->select('table.contents.cid', 'table.contents.title', 'table.contents.slug', 'table.contents.created', 'table.contents.authorId',
    'table.contents.modified', 'table.contents.type', 'table.contents.status', 'table.contents.text', 'table.contents.commentsNum', 'table.contents.order',
    'table.contents.template', 'table.contents.password', 'table.contents.allowComment', 'table.contents.allowPing', 'table.contents.allowFeed',
    'table.contents.parent','table.contents.test_url','table.contents.test_word','table.contents.test_img')->from('table.contents');
}

上面步骤操作完成后,撰写文章页面如下图
[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载
到这里PHP7下的主题安装完毕。
PS:以上PHP7环境下主题修改内容已经修改整合打包好了,抓虾网下面提供有PHP7.0版本主题下载地址,不会修改代码的朋友可以直接下载使用。

下载地址1:https://www.lanzous.com/i14m00h

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (1)

抓虾网 导航源码 [Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载 https://www.zhuax.com/219.html

[Typecho主题]炫酷网址导航网站主题TiNav 2.0免费下载
上一篇:

已经没有上一篇了!

相关文章

官方客服团队

为您解决烦忧 - 24小时在线 专业服务