1.显示指定catid的栏目名称和链接 {$CATEGORYS[25]['catname']}  {$CATEGORYS[25]['url']}
 获取父栏目id/获取父栏目名称  $CATEGORY[$catid][parentid]}  父栏目名称:{$CATEGORYS[$CAT[parentid]][catname]}

去掉标题限制后出现的省略号
    {str_cut($r[title],36,'...')}

格式化时间 2011-05-06 11:22:33

{date('Y-m-d H:i:s',$r[inputtime])}

{date('Y年m月d日',$r[inputtime])}

------------------------------------------------------------------------------------------------------

2.调用子栏目(在栏目首页模板需要用到,列表页也可以用到)

{pc:content action="category" catid="$catid" num="25" siteid="$siteid" order="listorder ASC"}
    {loop $data $r}

<a href="{$r[url]}">{$r[catname]}</a> |
   {/loop}{/pc}
------------------------------------------------------------------------------------------------------

3.得到指定栏目下的新闻

(1)这里moreinfo="1"表示主副表关联起来 可以直接使用
            {pc:content action="lists" catid="$catid" num="25" order="id DESC" return="info" moreinfo="1"} 
              {loop $info $r}
             更新日期:{date('Y年m月d日',$r[updatetime])}
             作者:{$r[username]}
             来源:{$r[copyfrom]}
             点击率{$r[readpoint]}
             网址{$r[url]}
             文章标题 {$r['title']}
             标题样式{title_style($v[style])}
                      
    {/loop}
    {/pc}

<p>=====================</p
  (2)sql万能语句可以调用指定内容 更方便
{pc:get sql="select * from v9_news as a,v9_news_data as b where a.id=b.id and catid=34 and status=99 order by a.id desc"}
     {loop $data $v} 
  <li><a href="{$v['url']}" target="_blank"><img src="{$v[thumb]}" width="146" height="117" /></a></li>            
    {/loop}
    {/pc}

{pc:get sql="select * from v9_news where catid=10 and status=99 order by updatetime desc" num="5" start="23"}
  {loop $data $rs}
      <a href="{$rs['url']}" title="{$rs['title']}" target="_blank">{$rs['title']}</a>
     {/loop}
 {/pc}

<p>=====================</p
   (3)文章从指定位置开始调用 (position推荐位使用)
    起始位置为5,调用3条。相当于limit功能。

{pc:content  action="position" posid="27" order="listorder DESC" num="3" start="5"}
        {loop $info $r}
                <a  href='{$r[url]}'>{str_cut($r[description],115)}... </a>
       {/loop}
    {/pc}
 或{pc:content  action="lists"  catid="54"  thumb=""  order="listorder DESC"  start="3" num="5"} thumb="" 不分类

<p>=====================</p>循环列表新闻
 
  <div class="content">
         {pc:content  action="position" posid="9" order="listorder DESC" num="4"}
          {loop $data $r}
              <a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],36,'')}</a>{date('Y-m-d H:i:s',$r[inputtime])}
                <p>{if $n==1}<img src="{thumb($r[thumb],90,60)}" width="90" height="60"/>{/if}{str_cut($r[description],112,'')}<a href="{$r[url]}">[reading more]</a></p>
               
               {/loop} 
             {/pc}  
            </div>
<p>=====================</p>
(4).有分页效果
    {pc:get sql="select * from wecheweyounews where hour=$hour order by id desc" return="data" num="50" page="$page"}
                <ul >
        {loop $data $r}
                    <li><span class="left">&middot;<a href="{$r['url']}" target="_blank">{str_cut($r['title'],60)}</a>(编辑:{$r[username]})</span><span class="right">{date("Y-m-d",$r['inputtime'])}</span></li></li>
                <?php
                if($n%5==0 and $n<50) echo "</ul><ul>";
                ?>
        {/loop}
                </ul>
            </div>
      <div id="pages" class="text-c">{$pages}</div>
     {/pc} 
------------------------------------------------------------------------------------------------------
4. <!--首页焦点图推荐 就图片切换那个东西-->
{pc:content  action="position" posid="1"  order="listorder DESC" thumb="1" num="5"}
 {loop $data $r}
  <a href="{$r['url']}" title="{str_cut($r['title'],30)}"><img src="{thumb($r['thumb'],300,200)}" alt="{$r['title']}" width="310" height="260" /></a>
    {/loop}
    {/pc}

5分页
 前台调用num="50"指每页50条记录
    {pc:get sql="select * from wecheweyounews where hour=$hour order by id desc" return="data" num="50" page="$page"}
                <ul >
        {loop $data $r}
                    <li><span class="left">&middot;<a href="{$r['url']}" target="_blank">{str_cut($r['title'],60)}</a>(编辑:{$r[username]})</span><span class="right">{date("Y-m-d",$r['inputtime'])}</span></li></li>
                <?php
                if($n%5==0 and $n<50) echo "</ul><ul>";
                ?>
        {/loop}
                </ul>
            </div>
      <div id="pages" class="text-c">{$pages}</div>
     {/pc}

转自:

偏爱的博客

phpcms标签用法(转)的更多相关文章

  1. PHPCMS标签大全

    {$head[title]} 页面标题,用法: {$phpcms[sitename]} 网站名称 用法: {$head[keywords]} 要害字 用法: {$head[description]} ...

  2. H5 新标签用法及解释

    HTML 5 是一个新的网络标准,目标在于取代现有的 HTML 4.01, XHTML 1.0 and DOM Level 2 HTML 标准.它希望能够减少浏览器对于需要插件的丰富性网络应用服务(p ...

  3. phpcms标签整理_当前栏目调用

    phpcms标签整理_当前栏目调用 转载 **//SQL语句调用: {pc:get sql="select * from phpcms_category where catid in($ca ...

  4. 【JSP】<meta>标签用法

    转载自:http://blog.sina.com.cn/s/blog_65c74cce0102v39z.html  非常感谢这位博主,急着用,改日再细细品味重新整理这篇博文. http-equiv M ...

  5. Web前端设计:Html强制不换行<nobr>标签用法代码示例

    在网页排版布局中比如文章列表标题排版,无论多少文字均不希望换行显示,需要强制在一行显示完内容.这就可以nobr标签来实现.它起到的作用与word-break:keep-all 是一样的.nobr 是 ...

  6. JAVA中的break[标签]continue[标签]用法

    原文:JAVA中的break[标签]continue[标签]用法 注意:JAVA中的标签必须放在循环之前,且中间不能有其他语句.例如:tag:for或while或do--while; 1.使用brea ...

  7. Thinkphp中的内置标签用法

    Thinkphp中的内置标签有:Volist,Foreach,For,Switch,比较标签,范围判断标签,IF,Present,Empty,Defined,Assign,Define,标签嵌套,im ...

  8. ThinkPHP模板IF标签用法详解

    投稿:shichen2014 字体:[增加 减小] 类型:转载 时间:2014-07-01 我要评论 这篇文章主要介绍了ThinkPHP模板IF标签用法,需要的朋友可以参考下 ThinkPHP的IF标 ...

  9. c-fmt-fn标签用法

      c-fmt-fn标签用法 CreateTime--2017年1月6日15:48:43 Author:Marydon 一.参考链接 http://blog.csdn.net/fmwind/artic ...

随机推荐

  1. openstack-wsgi的route中添加api流程具体解释(os-networks)添加

    感谢朋友支持本博客.欢迎共同探讨交流,因为能力和时间有限,错误之处在所难免.欢迎指正! 如有转载,请保留源作者博客信息. Better Me的博客:blog.csdn.net/tantexian 如需 ...

  2. Credit Risk Scorecards Credit Risk Modeling 评分卡 KS AR

    https://cn.mathworks.com/help/finance/creditscorecard.validatemodel.html?requestedDomain=www.mathwor ...

  3. ABAP OLE

    OLE DATA: excel TYPE ole2_object, workbook TYPE ole2_object, sheet TYPE ole2_object, cell TYPE ole2_ ...

  4. go8---函数function

    package main /* 函数function Go 函数 不支持 嵌套.重载和默认参数. 但支持以下特性: 无需声明原型(C语言在使用函数之前需要声明函数的原型).不定长度变参.多返回值.命名 ...

  5. golang中管道热替换

    golang中管道替换问题 https://blog.csdn.net/cyk2396/article/details/78875347 1.运行以下代码: var chan1 chan int va ...

  6. python 视频逐帧保存为图片

    import cv2 import os def save_img(): video_path = r'F:\test\video1/' videos = os.listdir(video_path) ...

  7. SPOJ BEADS 最小字符串表示

    SPOJ BEADS 给一个字符串(环) 问从哪个字符开始,字典序最小. 可以脑补到很多线性的解法,不过以下这个是最简单的,代码非常简单,就不解释了. #include<iostream> ...

  8. 830C

    分块+二分 这道题思路很巧妙 我们大概可以推出一个式子sigma(d-[(ai-1)%d+1])<=k,要求求出d的最大值 然后我们化简一下,sigma(d-[(ai-1)-[(ai-1)/d] ...

  9. 移动前端第二弹:善用meta

    前言 在移动前端第一弹:viewport详解中,我们讲了viewport,那是一个关于meta的故事.这次我们会就将meta这个故事讲得更广阔.更有意思一些. 写过HTML的童鞋,应该都对这个不陌生, ...

  10. sshd服务器搭建管理和防止暴力破解

    1.1 Linux服务前期环境准备,搭建一个RHEL7环境 1.2 sshd服务安装-ssh命令使用方法 1.3 sshd服务配置和管理 1.4 防止SSHD服务暴力破解的几种方式 1.1 Linux ...