# 使用说明
## 一.安装
1. 首先打开<http://localhost/install> 点击接受
![k6rP2V.png](https://s2.ax1x.com/2019/02/18/k6rP2V.png)
2. 如果提示
![k6rZVJ.png](https://s2.ax1x.com/2019/02/18/k6rZVJ.png)
说明fileinfo未开启,如果安装了phpstudy,打开其他选项菜单,按照下图找到php-ini,打开php-ini修改
![k6rQxK.png](https://s2.ax1x.com/2019/02/18/k6rQxK.png)
搜索关键词fileinfo,对应行前边的;去掉;重启phpstudy
![k6raGt.png](https://s2.ax1x.com/2019/02/18/k6raGt.png)
刷新页面,如果fileinfo开启成功,那么点击下一步
![k6rwxf.png](https://s2.ax1x.com/2019/02/18/k6rwxf.png)
3. 填写数据库地址
![k6s9dH.png](https://s2.ax1x.com/2019/02/18/k6s9dH.png)
数据库服务器填写默认的127.0.0.1;数据库端口默认的3306;数据库用户名密码默认root;数据库名称自己填写(建议项目名称字母缩写);数据库表前缀同理;数据库编码utf8mb4;项目名称按照项目填写,按照项目类型勾选手机和pc(后台也可修改);管理员帐号默认afanda;密码默认afd3103和之前统一;填写完毕点击创建数据
4. 安装完成
> 为了您的站点安全,安装完成后即可将网站「application」目录下的「install」目录删除!如想重新安装请删除「datas」目录下的「install.lock」文件,并且修改 「config」目录下的「database.php」文件为返回空数组。然后重新访问安装路径 /install
![k6sVQf.png](https://s2.ax1x.com/2019/02/18/k6sVQf.png)
---
## 二.后台界面
默认后台地址 http://localhost/manage
如果登录提示下图
![k64V4U.png](https://s2.ax1x.com/2019/02/18/k64V4U.png)
那么打开phpstudy,按照下图打开php_openssl
![k64eCF.png](https://s2.ax1x.com/2019/02/18/k64eCF.png)
修改完成后,就可以进入后台了, 界面如下图
![k6yDEQ.png](https://s2.ax1x.com/2019/02/18/k6yDEQ.png)
常用设置在**系统设置**>**系统设置** >**网站设置**里,如下图
![k6y2vV.png](https://s2.ax1x.com/2019/02/18/k6y2vV.png)
上传附件(图片)设置(文件格式,文件大小)在**系统设置**>**系统设置** >**附件设置**里,默认图片格式有**jpg,png,gif**,默认文件格式有**doc,xls,pdf**,默认文件都是2048kb,如下图所示。
![k6ho1H.png](https://s2.ax1x.com/2019/02/18/k6ho1H.png)
主题模板在**主题管理**里
![k65AsA.png](https://s2.ax1x.com/2019/02/18/k65AsA.png)
网站栏目在顶部菜单的**cms**里,里边有**管理栏目,管理信息**。
![k653ss.png](https://s2.ax1x.com/2019/02/18/k653ss.png)
**系统模型**里,类似帝国的数据表形式,可以增加修改系统模型,字段
管理栏目可以增加/修改栏目
![k6oEUP.png](https://s2.ax1x.com/2019/02/18/k6oEUP.png)
详情如下,基本属性添加栏目信息
![k6o8U0.png](https://s2.ax1x.com/2019/02/18/k6o8U0.png)
选项设置添加栏目属性,选择栏目模板
![6oQDs.png](https://s2.ax1x.com/2019/02/18/k6oQDs.png)
页面管理首先要增加页面分类
![k6ozaq.png](https://s2.ax1x.com/2019/02/18/k6ozaq.png)
页面管理添加页面
![k6TCGT.png](https://s2.ax1x.com/2019/02/18/k6TCGT.png)
栏目创建完毕后,可以添加信息
![k6TAsJ.png](https://s2.ax1x.com/2019/02/18/k6TAsJ.png)
基本属性添加文章内容
![k6TKJK.png](https://s2.ax1x.com/2019/02/18/k6TKJK.png)
选项设置可以设置文章模板等信息
![k6T1Qe.png](https://s2.ax1x.com/2019/02/18/k6T1Qe.png)
---
## 三.主题设置
1.主题文件夹路径
pc端默认在**tpl>index>pc**里
![k6Ttot.png](https://s2.ax1x.com/2019/02/18/k6Ttot.png)
主题文件夹下目录大致如下
![k2P7KH.png](https://s2.ax1x.com/2019/02/20/k2P7KH.png)
**README.txt** :主题名称
**screenshot**:主题截图
**pages_index**:默认页面内容页
**layout**:入口文件
**index_index**: 首页文件
**conlumns_index**:默认分类列表页面
**contents_index**:默认文章内容页
**search_index**:搜索结果列表页
**pages_***:页面文件命名方式
**conlumns_***:分类文件命名方式
**contents_***:文章详情页面命名方式
---
## 四.基础调用
- 主题目录函数 <?=$themeUri?>,指向当前主题下**static**文件夹,例:
```php
<link rel="stylesheet" href="<?=$themeUri?>/css/global.css?=<?php echo time();?>" />
```
指向当前主题文集夹下路径为:
```html
<link rel="stylesheet" href="/tpl/index/pc/afanda/static/css/global.css?=1550536341" />
```
- 判断是否为首页,方法:
```php
<?php if($request_uri == '/') {?>class="active" <?php }?>
```
<?php $request_uri;?> 这个函数输出对应 页面网址路径
- 判断是否为某单页,方法:
``` php
if(the_ID()=='3'{}
```
- 判断是否为某栏目,方法:
``` ph
if(the_columnID()=='1'{}
```
- 简单的导航判断高亮,例:
``` php
<a href="/" <?php if($request_uri == '/') {?>class="active" <?php }?>>首页</a>
<a href="/aboutus.html" <?php if(the_ID()=='3'){?>class="active"<?php }?>>关于佰圣</a>
<a href="/service" <?php if(the_columnID()=='1'){?>class="active"<?php }?>>医学检验服务</a>
```
> 说明:如果为首页,那么首页输出class="active";如果为单页(内容详情页)且id为3,那么关于佰圣输出class=“active”;如果分类为1,那么医学检验服务输出class=“active”
- 引入php文件,方法
```php
{include file="name"}
```
引入当前目录下名字为**name.php**的文件
- 打印后台信息
```php
<?=dump($app_info)?>
```
展示结果:
```html
array(3) {
["app"] => array(5) {
["name"] => string(12) "佰圣医学"
["index_pc"] => int(1)
["index_wap"] => int(1)
["shop_pc"] => int(0)
["shop_wap"] => int(0)
}
["site"] => array(14) {
["url"] => string(1) "/"
["title"] => string(12) "佰圣医学"
["keywords"] => string(12) "佰圣医学"
["description"] => string(12) "佰圣医学"
["icp"] => string(0) ""
["admin_email"] => string(0) ""
["phone"] => string(0) ""
["qq"] => string(0) ""
["copyright"] => string(0) ""
["statics"] => string(0) ""
["is_layout"] => int(1)
["pc_status"] => int(1)
["wap_status"] => int(1)
["close_reason"] => string(18) "网站维护中..."
}
["shop"] => array(14) {
["url"] => string(1) "/"
["title"] => string(12) "afanda's cms"
["keywords"] => string(12) "afanda's cms"
["description"] => string(12) "afanda's cms"
["icp"] => string(0) ""
["admin_email"] => string(0) ""
["phone"] => string(0) ""
["qq"] => string(0) ""
["copyright"] => string(0) ""
["statics"] => string(0) ""
["is_layout"] => int(1)
["close_reason"] => string(18) "商城维护中..."
["pc_status"] => int(0)
["wap_status"] => int(0)
}
}
```
输出后台设置电话:
```php
<?php echo $app_info['site']['phone'];?>
```
- 调取幻灯片
调取单张幻灯片
```php
<?php $slide = query_slides(1);?>
<li><img src="<?=$slide['image_uri']?>" alt="<?=$slide['title']?>" href="<?=$slide['url']?>"/></li>
```
1为幻灯片分类id
调取多张幻灯片
```php
<?php $slides = query_slides('category_id=3');foreach ($slides as $slide) {?>
<li style="background-image: url(<?= $slide['image_uri']?>);" alt="<?=$slide['title']?>" href="<?=$slide['url']?>"></li>
<?php }?>
```
3为幻灯片分类id
- 调取id为5栏目下的信息,调取6条
```php
<?php $contents = query_contents('column_id=5&limit=6');foreach ($contents as $v) {?>
<div class="lists-item"><a href="<?=$v['url']?>">· <?= utf8_substr($v['title'], 40); ?>...</a></div>
<?php }?>
```
- 输出列表可调取字段,接上面
```php
<?=echo dump('$v')?>
```
输出结果:
```html
array(36) {
["id"] => int(8)
["mod_id"] => int(1)
["tbname"] => string(4) "news"
["column_id"] => int(5)
["category_id"] => int(0)
["userid"] => int(1)
["username"] => string(6) "afanda"
["ismember"] => int(0)
["ispic"] => int(0)
["isgood"] => int(0)
["title"] => string(7) "新闻1"
["url"] => string(9) "/xw1.html"
["ftitle"] => string(0) ""
["post_time"] => string(19) "2019-02-19 14:05:56"
["province"] => int(0)
["city"] => int(0)
["district"] => int(0)
["titlepic"] => string(0) ""
["access_role_ids"] => string(0) ""
["external_link"] => string(0) ""
["keywords"] => string(0) ""
["author"] => int(0)
["source"] => int(0)
["tags"] => string(0) ""
["diy_browse_nums"] => int(0)
["actual_browse_nums"] => int(0)
["comment_nums"] => int(0)
["checked"] => int(1)
["pc_template"] => string(0) ""
["wap_template"] => string(0) ""
["list_order"] => int(0)
["create_time"] => string(19) "2019-02-19 14:07:06"
["update_time"] => string(19) "2019-02-19 14:07:06"
["delete_time"] => int(0)
["post_time_ymd"] => string(10) "2019-02-19"
["vice_data"] => array(4) {
["id"] => int(8)
["column_id"] => int(5)
["smalltext"] => string(6) "简介"
["content"] => string(12) "文章详情"
}
}
```
想要输出文章id字段:
```php
<?= $v['id']?>
```
想要输出文章标题:
```php
<?echo $v['title']?>
```
想要输出文章详情字段:
```php
<?= $v['vice_data']['content']?>
```
输出文章标题截取字符:
```php
<?= utf8_substr($v['title'], 40); ?>...
```
<font color=red>注:$v为上边列表循环定义字段,详情按照实际为主</font>
- 调取文章详情信息全部字段
```php
<?= dump(query_contents())?>
```
输出结果如下:
```html
array(36) {
["id"] => int(7)
["mod_id"] => int(1)
["tbname"] => string(4) "news"
["column_id"] => int(1)
["category_id"] => int(0)
["userid"] => int(1)
["username"] => string(6) "afanda"
["ismember"] => int(0)
["ispic"] => int(1)
["isgood"] => int(0)
["title"] => string(9) "区453425"
["url"] => string(13) "/q453425.html"
["ftitle"] => string(9) "235252525"
["post_time"] => string(19) "2019-02-19 11:28:43"
["province"] => int(0)
["city"] => int(0)
["district"] => int(0)
["titlepic"] => string(70) "/uploads/manage/images/1/20190219/61741ae580c0b3652d43c98061a9aced.png"
["access_role_ids"] => string(0) ""
["external_link"] => string(0) ""
["keywords"] => string(0) ""
["author"] => int(0)
["source"] => int(0)
["tags"] => string(0) ""
["diy_browse_nums"] => int(0)
["actual_browse_nums"] => int(0)
["comment_nums"] => int(0)
["checked"] => int(1)
["pc_template"] => string(0) ""
["wap_template"] => string(0) ""
["list_order"] => int(0)
["create_time"] => string(19) "2019-02-19 11:28:48"
["update_time"] => string(19) "2019-02-19 13:20:13"
["delete_time"] => int(0)
["post_time_ymd"] => string(10) "2019-02-19"
["vice_data"] => array(4) {
["id"] => int(7)
["column_id"] => int(1)
["smalltext"] => string(8) "25252525"
["content"] => string(11) "25252552523"
}
}
```
获取文章标题:
```php
<?=query_contents()['title'] ?>
```
获取文章内容
```php
<?=query_contents()['vice_data']['content']?>
```
- 面包屑导航
目前没有自带,需要自己写,简单无二级分类面包屑导航如下:
```php
<div class="breaknav">您当前所在位置:
<a href="/">首页</a>>
<a href="<?php echo query_columns(query_contents()['column_id'])['url'];?>"><?php echo query_columns(query_contents()['column_id'])['name'];?></a>>
<a href="<?= query_contents()['url'];?>"><?= utf8_substr(query_contents()['title'],30);?></a>
</div>
```
> ```php
> <?php echo query_columns(query_contents()['column_id'])['url'];?>
> ```
>
> 根据文章分类获取分类信息的链接
>
> ```php
> <?= utf8_substr(query_contents()['title'],30);?>
> ```
>
> 截取当前文章标题文字共30个字符
- 文章分页
pc端:注意要有 pagination.php文件
pagination.php文件内容
```php
<?php if (!empty($pager) && $pager['count']) {?>
<script>
$('body').pagination({
elem: 'page', // 要渲染的 dom id,不需要加 #
total: <?=$total?>, // 是否显示信息总数文本
page: <?=$page?>, // 是否显示页码,显示格式:1/10
count: '<?=$pager["count"]?>', // 总页码
limit: '<?=$pager["perPage"]?>', // 每页显示的条数
curr: '<?=$pager["page"]?>', // 当前页码
groups: '<?=$pager['links']?>', // 连续出现的页码个数
});
</script>
<?php }?>
```
> 首先在 layout.php里
>
> ```php
> <script>var jsLang = <?=$jsLang?></script>
> <script src="<?=$staticUri?>/js/maniac.ui.js"></script>
> ```
然后在后台设置每页数量:
![k2EilT.png](https://s2.ax1x.com/2019/02/20/k2EilT.png)
接着在对应分类列表php文件:
```php
<div class="article-list clearfix">
<?php $contents = query_contents('column_id='.the_columnID().'&limit='.$pager['limit']);foreach ($contents as $v) {?>
<div class="list-item"><a href="<?=$v['url']?>" title="<?=$v['title']?>" class="titles"><?=$v['title']?></a><span class="time">2019-12-31</span></div>
<?php }?>
</div>
<div id="page" class="m-pages clearfix"></div>
<?=widget('Pagination/index', ['pager' => $pager, 'public' => 1, 'total' => 0, 'page' => 0]);?>
```
> ```php
> <?php $contents = query_contents('column_id='.the_columnID().'&limit='.$pager['limit']);foreach ($contents as $v) {?>
> <?php }?>
> ```
>
> 这个是循环是按照后台设置每页数量调取
>
> ```php
> <div id="page" class="m-pages clearfix"></div>
> <?=widget('Pagination/index', ['pager' => $pager, 'public' => 1, 'total' => 0, 'page' => 0]);?>
> ```
>
> 这个是分页固定格式
网友评论