开发框架 版主:迅睿框架研发组
内容页中的专用图片提取第一张作为列表页的缩略图怎么调用
类型:迅睿CMS 更新时间:2023-04-16 20:19:52 order=displayorder

image

内容页中的专用图片,提取第一张作为首页,封面页,列表页的缩略图,怎么调用?下面是我调用的。请指正:

试尝一:

{category module=share pid=1 num=10 order=displayorder}
{module module=store catid=$t.id num=32 return=r}
              
                <?php $mycat=dr_share_cat_value('thumb');?><?php if ($thumb) { $key=0; foreach ($thumb as $c) { ?>
              
                   <img src="{dr_thumb($c, 372, 279)}" alt="{php $myfile=\Phpcmf\Service::C()->get_attachment($c);}{$myfile.filename}"/> 
             
                <?php $key++;} } ?>
            
{/module}
{/category}

尝试二:

{category module=share pid=1 num=10 order=displayorder}  
{module module=store catid=$t.id num=32 return=r}

              {loop $t.thumb $i $c}
            <img src="{dr_get_file($c)}" style="width:285px; height:285px;" alt="{$r.title}"></a> 
              {/loop}
      
{/module}
{/category}


多种试尝都调不出。请帮忙,谢谢

回帖
  • 迅睿框架技术-小陌
    #1楼    迅睿框架技术-小陌
    2023-04-16 17:16:10
    小米手机 0
    两个写法都不对,可以在第二种的基础上稍微改进一下,手机手机回复不方便写代码,自己研究一下,在第二种代码上修改
  • 小波工作室
    #2楼    小波工作室
    2023-04-16 18:15:01
    Chrome 0
    {category module=share pid=1 num=10 order=displayorder}  
    {module module=t.mid catid=$t.id num=32 return=r}
    
                  {loop $r.thumb $i $c}
                <img src="{dr_get_file($c)}" style="width:285px; height:285px;" alt="{$r.title}"></a> 
                {php break;}
                  {/loop}
          
    {/module}{$debug_r}
    {/category}{$debug}
    满意答案
  • 57自学网
    #3楼    57自学网
    2023-04-16 19:25:36
    Chrome 0
    小波工作室
    image
    我搞出来了。但是标题显示个 8 是怎么来的。
    image
    后台是标题:
    image
  • 57自学网
    #4楼    57自学网
    2023-04-16 19:53:10
    Chrome 0
    迅睿框架技术-小陌 老师。帮我看下,两图对照标出的位置。是什么回事啊。从一个{$r.url}标题。为什么一个能出来一个乱出来
    image

    image
  • 57自学网
    #5楼    57自学网
    2023-04-16 20:19:25
    Chrome 0
    57自学网
    {php $i=0;}
    {category module=share pid=1 num=10 order=displayorder}
          <div class="blk-sm fr" style="width: 1200px;">
        <div class="leftnav-z1 b">
              <h3 class="leftnav-z1-tit"><span>{$i+1}F&nbsp;&nbsp;<a style="color:#337ab7;" >{$t.name}</span></h3>
            </div>
    		{module module=store catid=$t.id num=32 return=t}
        <div class="leftnav-z1-list"> 
              <dl>
            <dt> 
                {loop $t.thumb $i $r}
                <a href="{$t.url}" >
                <img src="{dr_thumb($r, 285, 285)}" style="width:285px; height:285px;" alt="{$t.title}"></a> 
                {/loop}
            </dt>
            <dd>
                <h4><a href="{$t.url}" >{$t.title}</a></h4>
            </dd>
          </dl>	
    	</div>
    {/module}
    	</div>
    {php $i++;}	
    {/category}
    以觖决,
  • 57自学网
    #6楼    57自学网
    2023-04-16 20:19:52
    Chrome 0
    @小波工作室:可以了,感谢大佬。{php $i=0;} {category module=share pid=1 num=10 order=displayorder} {$i+1}F {$t.name} {module module=store catid=$t.id num=32 return=t} {loop $t.thumb $i $r} {/loop} {$t.title} {/module} {php $i++;} {/category}