• phpcms:五、网站首页(index.html)


    1、经典案例:
    图文列表:
    {pc:content  action="position" posid="2" order="listorder DESC" num="4"}
                 {loop $data $r}
                    <h4 class="blue"><a href="{$r[url]}" title="{$r

    [title]}">{str_cut($r[title],36,'')}-----------88888778-----</a></h4>
                    <p>{if $n==1}<img src="{thumb($r[thumb],90,60)}"

    width="90" height="60"/>{/if}{str_cut($r[description],112)}</p>
                    <div class="bk20 hr"><hr /></div>
                   {/loop}  
                 {/pc}   
    2、标题截取
    {str_cut($r[title],36,'')}:截取36个字符
    3、是不是第一条数据
    {if $n==1}<img src="{thumb($r[thumb],90,60)}" width="90" height="60"/>

    {/if}:如果是第一条数据,就显示缩略图({thumb($r[thumb],90,60)})

    4、焦点图调用
      {pc:content  action="position" posid="1"  order="listorder DESC"

    thumb="1" num="5"}
                    <div class="content" id="main-slide">
                        <div class="changeDiv">  
                        {loop $data $r}
                            <a href="{$r['url']}" title="{str_cut($r

    ['title'],30)}"><img src="{thumb($r['thumb'],310,260)}" alt="{$r

    ['title']}" width="310" height="260" /></a>
                        {/loop}
                        </div>
                    </div>
                {/pc}
    必须有缩略图:thumb="1"
    5、碎片
    {pc:block pos="index_block_1"}{/pc} (pos:碎片位置标识符)

    6.碎片格式化数据默认模板:
    {$name}
    <ul>
    {loop $data $i $r}
    <li style="clear:both">
    <a href="{$r[url]}">{$r[title]}</a><br />
    <div style="color:#ccc;">{if $r[thumb]}<img src="{$r[thumb]}"

    style="float:left">{/if}{$r[desc]}
    </div>
    {/loop}
    </li>
    </ul>

    如果存在缩略图,就显示出来:{if $r[thumb]}<img src="{$r[thumb]}"

    style="float:left">{/if}


    {thumb($r[thumb],110,0)}宽度:100,高度:自动。

    7.隔行运算符:
    {if $num%2!=0}style=" margin-right:10px"{/if}(如果是奇数行,就跟右边的距

    离为10px)。
    {if $num%2==0}<div class="bk10"></div>{/if}(如果是偶数行,就显示<div

    class="bk10"></div>)
    -----------------------------------------------
    8.各个模型+一级栏目+最新缩略图+几篇文章
     {loop subcat(0,0,0,$siteid) $r}
            {php $num++}
            <div class="box cat-area" {if $num%2!=0}style=" margin-

    right:10px"{/if}>
                    <h5 class="title-1">{$r[catname]}{$r[catid]}<a

    href="{$r[url]}" class="more">更多>></a></h5>
                 <div class="content">
                 {pc:content  action="lists" catid="$r[catid]"

    order="updatetime DESC" thumb="1" num="1" return="info"}
                 {loop $info $v}
                     <p>
                         <img src="{thumb($v[thumb],90,0)}" width="90"

    height="60"/>
                        <strong><a href="{$v['url']}" target="_blank"

    title="{$v['title']}"{title_style($v[style])}>{str_cut($v['title'],28)}

    </a></strong><br />{str_cut($v['description'],100)}
                    </p>
                  {/loop}
                  {/pc}                
                    <div class="bk15 hr"></div>
                    {pc:content action="lists" catid="$r[catid]" num="5"

    order="id DESC" return="info"}

                    <ul class="list lh24 f14">
                    {loop $info $v}
                        <li>·<a href="{$v['url']}" target="_blank"

    title="{$v['title']}"{title_style($v[style])}>{str_cut($v['title'],40)}

    </a></li>
                    {/loop}
                    </ul>
                    {/pc}
                </div>
            </div>
            {if $num%2==0}<div class="bk10"></div>{/if}
            {/loop}
    -------------------------------------------------
    9.公告:
    没有url,只能这样
    {pc:announce  action="lists" siteid="$siteid" num="2"}
                    <ul class="list lh24 f14">
                       {loop $data $r}
                         <li> <a href="{APP_PATH}index.php?

    m=announce&c=index&a=show&aid={$r['aid']}">{$r['title']}</a></li>
                       {/loop}
                    </ul>
                    {/pc}
    10.专题
    {pc:special  action="lists" siteid="$siteid" elite="1" listorder="3"

    num="2"}
                {loop $data $r}
                    {if $n!=1}<div class="hr bk15"></div>{/if}
                    <p style="margin:0">
                         <a href="{$r[url]}"><img src="{$r[thumb]}"

    width="90" height="70" /></a>
                        <strong><a href="{$r[url]}">{str_cut($r

    [title],'18')}</a></strong><br />{str_cut($r['description'],50)}
                    </p>
                {/loop}
                {/pc}

    elite="1":精华、加精
    11.排行
    {pc:content action="hits" catid="6" num="10" order="views DESC"}
                    {loop $data $r}
                        <li><a href="{$r[url]}"

    target="_blank" title="{$r[title]}"{title_style($r[style])}>{$r[title]}

    </a></li>
                    {/loop}
    {/pc}

    11.投票
    <h5 class="title-2">调查问卷<a href="{APP_PATH}index.php?

    m=vote&c=index&siteid={$siteid}" class="more">更多>></a></h5>
     
    <script language="javascript" src="{APP_PATH}index.php?

    m=vote&c=index&a=show&action=js&subjectid=1&type=3"></script>
    12.申请友情链接
    <h5><a href="{APP_PATH}index.php?m=link&siteid={$siteid}"

    hidefocus="true" class="rt">更多>></a>友情链接<a href="{APP_PATH}

    index.php?m=link&c=index&a=register&siteid={$siteid}" class="red">申请链

    接</a></h5>

    友情链接的设置内容:
    {pc:link  action="type_list" siteid="$siteid" linktype="1"

    order="listorder DESC" num="8" return="pic_link"}
            {loop $pic_link $v}

    linktype="4" :文字的友情链接
    linktype="1" :图片的友情链接
    13.嵌套说明
    {pc:link  action="type_list" siteid="$siteid" order="listorder DESC"

    num="10" return="dat"}
        {loop $dat $v}
        <!--循环体-->
            {pc:link  action="type_list" siteid="$siteid" linktype="1"

    order="listorder DESC" num="8" return="pic_link"}
            {loop $pic_link $v}
            <!--循环体-->
            {/loop}
            {/pc}

  • 相关阅读:
    Django之web本质
    Python之队列
    Python之阻塞IO模型与非阻塞IO模型
    *****Python之进程线程*****
    ***Python之UDP***
    Python之FTP实现
    Python之粘包
    Python之目录结构
    Python之套接字
    Linux内核分析:Linux内核启动流程分析
  • 原文地址:https://www.cnblogs.com/shark1100913/p/5578342.html
Copyright © 2020-2023  润新知