Blogger Information
Blog 95
fans 0
comment 11
visits 248592
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
首页与列表页模板
龍__遇见彩虹的博客
Original
2747 people have browsed it

首页与列表页模板

index.php   部分代码  控制器

<?php
namespace app\index\controller;

use app\common\controller\Base;
use app\common\model\ArtCate;
use app\common\model\Article;
use think\facade\Request;

/**
 * 网站首页
 */
class Index extends Base
{
	/**
	 * 显示网站首页
	 */
    public function index()
    {
    	//分类显示
    	$cateId = Request::param('cate_id');
    	//判断是否存在,然后分类显示
    	if(isset($cateId)){
    		$res = ArtCate::get($cateId);
    		$this->assign('cateName', $res->name);
    	}else{
    		$this->assign('cateName', '全部文章');
    	}
    	
    	
    	$this->assign('title', '网站首页');
    	return $this->view->fetch("index");
    }



index.html   前端页面

<h2>{$cateName}</h2><!--输出标题-->





*************************************

通过判断浏览器请求的ID进行比对

*************************************


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post