# 使用說明
## 一.安裝
1. 首先打開<http://localhost/install>? 點擊接受

2. 如果提示

說明fileinfo未開啟,如果安裝了phpstudy,打開其他選項菜單,按照下圖找到php-ini,打開php-ini修改

搜索關(guān)鍵詞fileinfo,對應(yīng)行前邊的;去掉;重啟phpstudy

刷新頁面,如果fileinfo開啟成功,那么點擊下一步

3. 填寫數(shù)據(jù)庫地址

數(shù)據(jù)庫服務(wù)器填寫默認(rèn)的127.0.0.1;數(shù)據(jù)庫端口默認(rèn)的3306;數(shù)據(jù)庫用戶名密碼默認(rèn)root;數(shù)據(jù)庫名稱自己填寫(建議項目名稱字母縮寫);數(shù)據(jù)庫表前綴同理;數(shù)據(jù)庫編碼utf8mb4;項目名稱按照項目填寫,按照項目類型勾選手機(jī)和pc(后臺也可修改);管理員帳號默認(rèn)afanda;密碼默認(rèn)afd3103和之前統(tǒng)一;填寫完畢點擊創(chuàng)建數(shù)據(jù)
4. 安裝完成
> 為了您的站點安全,安裝完成后即可將網(wǎng)站「application」目錄下的「install」目錄刪除!如想重新安裝請刪除「datas」目錄下的「install.lock」文件,并且修改 「config」目錄下的「database.php」文件為返回空數(shù)組。然后重新訪問安裝路徑 /install

---
## 二.后臺界面
默認(rèn)后臺地址 http://localhost/manage
如果登錄提示下圖

那么打開phpstudy,按照下圖打開php_openssl

修改完成后,就可以進(jìn)入后臺了, 界面如下圖

常用設(shè)置在**系統(tǒng)設(shè)置**>**系統(tǒng)設(shè)置** >**網(wǎng)站設(shè)置**里,如下圖

上傳附件(圖片)設(shè)置(文件格式,文件大?。┰?*系統(tǒng)設(shè)置**>**系統(tǒng)設(shè)置** >**附件設(shè)置**里,默認(rèn)圖片格式有**jpg,png,gif**,默認(rèn)文件格式有**doc,xls,pdf**,默認(rèn)文件都是2048kb,如下圖所示。

主題模板在**主題管理**里

網(wǎng)站欄目在頂部菜單的**cms**里,里邊有**管理欄目,管理信息**。

**系統(tǒng)模型**里,類似帝國的數(shù)據(jù)表形式,可以增加修改系統(tǒng)模型,字段
管理欄目可以增加/修改欄目

詳情如下,基本屬性添加欄目信息

選項設(shè)置添加欄目屬性,選擇欄目模板

頁面管理首先要增加頁面分類

頁面管理添加頁面

欄目創(chuàng)建完畢后,可以添加信息

基本屬性添加文章內(nèi)容

選項設(shè)置可以設(shè)置文章模板等信息

---
## 三.主題設(shè)置
1.主題文件夾路徑
pc端默認(rèn)在**tpl>index>pc**里

主題文件夾下目錄大致如下

**README.txt** :主題名稱
**screenshot**:主題截圖
**pages_index**:默認(rèn)頁面內(nèi)容頁
**layout**:入口文件
**index_index**: 首頁文件
**conlumns_index**:默認(rèn)分類列表頁面
**contents_index**:默認(rèn)文章內(nèi)容頁
**search_index**:搜索結(jié)果列表頁
**pages_***:頁面文件命名方式
**conlumns_***:分類文件命名方式
**contents_***:文章詳情頁面命名方式
---
## 四.基礎(chǔ)調(diào)用
- 主題目錄函數(shù) <?=$themeUri?>,指向當(dāng)前主題下**static**文件夾,例:
```php
<link rel="stylesheet" href="<?=$themeUri?>/css/global.css?=<?php echo time();?>" />
```
指向當(dāng)前主題文集夾下路徑為:
```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;?> 這個函數(shù)輸出對應(yīng) 頁面網(wǎng)址路徑
- 判斷是否為某單頁,方法:
``` php
if(the_ID()=='3'{}
```
- 判斷是否為某欄目,方法:
``` ph
if(the_columnID()=='1'{}
```
- 簡單的導(dǎo)航判斷高亮,例:
``` php
<a href="/" <?php if($request_uri == '/') {?>class="active" <?php }?>>首頁</a>
<a href="/aboutus.html" <?php if(the_ID()=='3'){?>class="active"<?php }?>>關(guān)于佰圣</a>
<a href="/service" <?php if(the_columnID()=='1'){?>class="active"<?php }?>>醫(yī)學(xué)檢驗服務(wù)</a>
```
> 說明:如果為首頁,那么首頁輸出class="active";如果為單頁(內(nèi)容詳情頁)且id為3,那么關(guān)于佰圣輸出class=“active”;如果分類為1,那么醫(yī)學(xué)檢驗服務(wù)輸出class=“active”
- 引入php文件,方法
```php
{include file="name"}
```
引入當(dāng)前目錄下名字為**name.php**的文件
- 打印后臺信息
```php
<?=dump($app_info)?>
```
展示結(jié)果:
```html
array(3) {
? ["app"] => array(5) {
? ? ["name"] => string(12) "佰圣醫(yī)學(xué)"
? ? ["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) "佰圣醫(yī)學(xué)"
? ? ["keywords"] => string(12) "佰圣醫(yī)學(xué)"
? ? ["description"] => string(12) "佰圣醫(yī)學(xué)"
? ? ["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) "網(wǎng)站維護(hù)中..."
? }
? ["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) "商城維護(hù)中..."
? ? ["pc_status"] => int(0)
? ? ["wap_status"] => int(0)
? }
}
```
輸出后臺設(shè)置電話:
```php
<?php echo $app_info['site']['phone'];?>
```
- 調(diào)取幻燈片
調(diào)取單張幻燈片
```php
<?php $slide = query_slides(1);?>
<li><img src="<?=$slide['image_uri']?>" alt="<?=$slide['title']?>" href="<?=$slide['url']?>"/></li>
```
1為幻燈片分類id
調(diào)取多張幻燈片
```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
- 調(diào)取id為5欄目下的信息,調(diào)取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 }?>
```
- 輸出列表可調(diào)取字段,接上面
```php
<?=echo dump('$v')?>
```
輸出結(jié)果:
```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']?>
```
想要輸出文章標(biāo)題:
```php
<?echo $v['title']?>
```
想要輸出文章詳情字段:
```php
<?= $v['vice_data']['content']?>
```
輸出文章標(biāo)題截取字符:
```php
<?= utf8_substr($v['title'], 40); ?>...
```
<font color=red>注:$v為上邊列表循環(huán)定義字段,詳情按照實際為主</font>
- 調(diào)取文章詳情信息全部字段
```php
<?= dump(query_contents())?>
```
輸出結(jié)果如下:
```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) "區(qū)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"
? }
}
```
獲取文章標(biāo)題:
```php
<?=query_contents()['title'] ?>
```
獲取文章內(nèi)容
```php
<?=query_contents()['vice_data']['content']?>
```
- 面包屑導(dǎo)航
目前沒有自帶,需要自己寫,簡單無二級分類面包屑導(dǎo)航如下:
```php
<div class="breaknav">您當(dāng)前所在位置:
<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'];?>
> ```
>
> 根據(jù)文章分類獲取分類信息的鏈接
>
> ```php
> <?= utf8_substr(query_contents()['title'],30);?>
> ```
>
> 截取當(dāng)前文章標(biāo)題文字共30個字符
- 文章分頁
pc端:注意要有 pagination.php文件
pagination.php文件內(nèi)容
```php
<?php if (!empty($pager) && $pager['count']) {?>
<script>
? ? $('body').pagination({
? ? ? ? elem: 'page',? ? ? ? ? ? ? ? ? ? ? ? // 要渲染的 dom id,不需要加 #
? ? ? ? total: <?=$total?>,? ? ? ? ? ? ? ? ? // 是否顯示信息總數(shù)文本
? ? ? ? page: <?=$page?>,? ? ? ? ? ? ? ? ? ? // 是否顯示頁碼,顯示格式:1/10
? ? ? ? count: '<?=$pager["count"]?>',? ? ? // 總頁碼
? ? ? ? limit: '<?=$pager["perPage"]?>',? ? // 每頁顯示的條數(shù)
? ? ? ? curr: '<?=$pager["page"]?>',? ? ? ? // 當(dāng)前頁碼
? ? ? ? groups: '<?=$pager['links']?>',? ? ? // 連續(xù)出現(xiàn)的頁碼個數(shù)
? ? });
</script>
<?php }?>
```
> 首先在 layout.php里
>
> ```php
> <script>var jsLang = <?=$jsLang?></script>
> <script src="<?=$staticUri?>/js/maniac.ui.js"></script>
> ```
然后在后臺設(shè)置每頁數(shù)量:

接著在對應(yīng)分類列表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 }?>
> ```
>
> 這個是循環(huán)是按照后臺設(shè)置每頁數(shù)量調(diào)取
>
> ```php
> <div id="page" class="m-pages clearfix"></div>
> <?=widget('Pagination/index', ['pager' => $pager, 'public' => 1, 'total' => 0, 'page' => 0]);?>
> ```
>
> 這個是分頁固定格式