thinkcmf随记

初来乍到,也是自己摸索
在做项目之前要先把官网的手册前端那一部分看一遍,后端的就要慢慢摸索。https://www.thinkcmf.com/docs/cmf/
说一些入门重点
1.每个页面要先引用 这一句包含了一些变量文件。要不然下边调用的话会报错,未定义变量。
2.前端文件名要使用小写或小写加下划线 有命名规范
常用标签
1.调用文章标签

<portal:articles limit="4" order="post.published_time DESC" categoryIds="1">
    
    	<a href="{:url('portal/Article/index',array('id'=>$vo.id,'cid'=>$vo.category_id))}">
    	{$vo.post_title}</a>
    	<img src="{:cmf_get_image_url($vo.more.thumbnail)}">
  </portal:articles>

2.友情链接

<div class="links">
     <links>
            <a href="{$vo.url|default=''}" target="{$vo.target|default=''}">{$vo.name|default=''}</a>&nbsp;
     </links>
</div>

3.分页标签 循环li
4.面包屑导航

<li><a href="/">首页</a></li>
  <portal:breadcrumb cid="category['id']" self="true">
    <li><a href="{:url('portal/List/index',['id'=>$vo['id']])}">{$vo.name}</a></li>
  </portal:breadcrumb>

5.根据id的不同高亮不同
使用比较标签

<li <if condition="!empty($category['id']) && ($category['id'] eq 14)">class="on"</if>><a href="{:url('portal/List/index', ['id' => 14])}">须知</a></li>
<li <if condition="!empty($category['id']) && ($category['id'] eq 15)">class="on"</if>><a href="{:url('portal/List/index', ['id' => 15])}">举报</a></li>
<li <if condition="!empty($category['id']) && ($category['id'] eq 16)">class="on"</if>><a href="{:url('portal/List/index', ['id' => 16])}">查询</a></li>
<li <if condition="!empty($category['id']) && ($category['id'] eq 17)">class="on"</if>><a href="{:url('portal/List/index', ['id' => 17])}">方式</a></li>

6.列表页

<portal:articles item="vo" order="post.create_time DESC" page="20" categoryIds="$category.id">
				<li><a href="{:url('portal/Article/index', ['id' => $vo['id'], 'cid' => $category['id']])}">{$vo.post_title}<span>{:date('Y-m-d', $vo['published_time'])}</span></a></li>
</portal:articles>

7文章页

<h1>{$article.post_title}</h1> //标题
<div class="author"> 作者:{$article.user.user_nickname}  发布时间:{:date('Y-m-d H:i',$article.published_time)}
</div>
<div class="nneir">
    	{$article.post_content} //文章内容
</div>

8指定栏目的url:{:url(‘portal/List/index’, [‘id’ => 16])}

9热门<portal:articles limit=“1,4” order=“post.recommended DESC” categoryIds=“73,75”>

10置顶order=“post.is_top DESC”
11摘要{KaTeX parse error: Expected 'EOF', got '}' at position 16: vo.post_excerpt}̲ 12点击 {vo.post_hits}

13幻灯片标签

{KaTeX parse error: Expected 'EOF', got '}' at position 19: …name|default=''}̲ {:cmf_get_imag…vo.image)}

14调用所有子栏目
<portal:allSubCategories categoryId=“138” item=“vo”>

  • {$vo.name}

  • </portal:allSubCategories>

    15调用最新置顶文章

    $where=[
    

    ‘post.is_top’=>1
    ];

    <portal:articles limit=“1” where="$where" order=“post.published_time DESC” categoryIds=“13”>
    </portal:articles>

    16循环文章调用出改文章所在分类
    <portal:articles limit=“4” order=“post.published_time DESC”
    categoryIds=“1”>

    <volist name="$vo.categories" id="item">
             <a href="{:url('portal/List/index', ['id' => $item.id])}">{$item.name}</a>
        </volist>
    

    </portal:articles>

    17thinkcmf模板开发教程之<二>动态循环输出轮播图

    <div class=“item active”>

    {$vo.title|default=''}


    前端调用完了差不多了,每一个文件都有一个.json文件都放在public\themes\simpleboot3\portal 下,.json文件名要与源文件名字相同,是列表页的就复制list.json文件改个名字,是文章页的就复制article.json文件改个名字

    登录后台—设置—模板管理—更新一下 即可在门户管理----分类管理 给分类换模板

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值