织梦列表如何有3张图显示3张或1张图无图不显示图片

织梦如何有略缩图就放略缩图,没略缩图就不显示图片

文章模型新建字段open  单选框默认选no    另外一个为yes

找到include/arc.listview.class.php

892行 开始把部分代码换成这样!记得名字$row['这里的名字, 只换litpic 到row[image] 部分的


                    if($row['litpic'] == '-' || $row['litpic'] == '')
                    {
                        $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif';
                        $row['litpics'] = '233';
                    }
                    if(!preg_match("/^http:\/\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y')
                    {
                        $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic'];
                         $row['litpics'] = '';
                    }
                    $row['picname'] = $row['litpic'];
                    $row['stime'] = GetDateMK($row['pubdate']);
                    $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
                    if($row['litpics'] != '233')
                    {
                                      $row['image'] = "<img class='list-img' src='".$GLOBALS['cfg_basehost'].$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".preg_replace("/['><]/", "", $row['title'])."'>";
                    }
                    else
                    {
                         $row['image'] ="";
                    }


然后列表页面调用的时候写[field:image/]

这是第一步。

 {dede:list pagesize='20' imgwidth=137 imgheight=205 titlelen="250" infolen="120" }
          <li>
[field:array runphp='yes'] 
                  if (@me['open']=='yes') @me = "
                   <a href=".@me['arcurl']." data-type='mip'  class='list-t3'>
                    <div class='txt'><h6>".@me['title']."</h6><p>".@me['infos']."</p></div>
                  <div class='list-imgs'>
                      <mip-img layout='responsive' width='400' class='list-img' height='300' src=http://www.csgt120.com".@me['litpic1']."> </mip-img>
                      <mip-img layout='responsive' width='400' class='list-img' height='300' src=http://www.csgt120.com".@me['litpic2']."> </mip-img>
                      <mip-img layout='responsive' width='400' class='list-img' height='300' src=http://www.csgt120.com".@me['litpic3']."> </mip-img>
                  </div>
                </a>
                  ";
                  else @me="
<a href=".@me['arcurl']." data-type='mip'  class=list-t1>
".@me['image']."  <div class='txt'><h6>".@me['title']."</h6><p>".@me['infos']."</p></div>
</a>
                "; 
[/field:array]
</li>
{/dede:list}

剩下的回家写!


写的好!

微信扫一扫赏大洋