已有模板与框架结合

在简单的视图调用

首先在 控制器

<?php
namespace app\index\controller;
use think\Controller;

class Index extends Controller
{
    public function index()
    {
        return $this->fetch(); 
         }

}

 已有模板index.html 放view目录下的index目录下

模板引入文件(css,images,js)放在  public\static\index下

config.php 文件一定要写好 视图输出 

'view_replace_str' => [ '__PUBLIC__' => '/static/index ',]

css现在的引入方式该为:

[html]  view plain  copy
  1. <link rel="stylesheet" type="text/css" href="__PUBLIC__/static/index/css/style.css">  

但是访问页面时 图片无法加载

此时图片跟css引入路径是一样的 ,所以只要在 页面的<img >中引入路径为 __PUBLIC__/static/index/images/图片名称

现在访问还发现有些图片无法加载 ,原因是引入的图片在css中 ,此时引入的路径就不一样了,

所以  将原本css样式中引入的图片 的路径为 ../images  原因是css与images在同一目录中




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
真的很不错的模板 <html <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Ext 做的后台管理系统</title> <style type="text/css"> body{ font-size:12px; background-image: url(images/bg.gif); background-repeat: repeat; } ul,li,h2{margin:0;padding:0;} ul{list-style:none;} #top{ width:909px; height:26px; background-image: url(images/h2bg.gif); margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; background-repeat: repeat-x; } #top h2{ width:150px; height:24px; float:left; font-size:12px; text-align:center; line-height:20px; color:#0066FF; font-weight: bold; padding-top: 2px; border-right-width: 1px; border-left-width: 1px; border-right-style: solid; border-left-style: solid; border-right-color: #99BBE8; border-left-color: #99BBE8; } #top .jg { width: 5px; float: left; background-color: #DCE6F5; height: 26px; } #topTags{ width:740px; height:24px; float:left; margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; padding-top: 2px; border-right-width: 1px; border-left-width: 1px; border-right-style: solid; border-left-style: solid; border-right-color: #99BBE8; border-left-color: #99BBE8; padding-left: 10px; } #topTags ul li{ float:left; width:100px; height:21px; margin-right:4px; display:block; text-align:center; cursor:pointer; padding-top: 3px; color: #15428B; font-size: 12px; } #main{ width:909px; height:501px; background-color:#F5F7E6; margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; } #main .jg { width: 5px; float: left; background-color: #DFE8F6; height: 500px; } #leftMenu{ width:150px; height:500px; background-color:#DAE7F6; float:left; border-right-width: 1px; border-left-width: 1px; border-right-style: solid; border-left-style: solid; border-right-color: #99BBE8; bor
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值