deber 发表于 2011-11-25 23:04:11

请教view视图中语句含义

本帖最后由 deber 于 2011-11-25 23:05 编辑

<div id="product_left">      <div id="product_image">               
<?php                //get the primary photo for the product         
   $photo      = '<img src="'.base_url('images/nopicture.png').'" alt="no picture available"/>';
                if(count($product->images) > 0 )      
          {                              $primary      = $product->images;            
         foreach($product->images as $image)               
       {                              if(isset($image->primary))               
                {               
                        $primary      = $image;                              }         
             }
                        $photo      = '<a href="'.base_url('uploads/images/medium/'.$primary->filename).'" rel="gallery" title="'.$primary->caption.'"><img src="'.base_url('uploads/images/small/'.$primary->filename).'" alt="'.$product->slug.'"/></a>';                }            
    echo $photo;
        if(!empty($primary->caption)):?>
                <div id="product_caption">
                        <?php echo $primary->caption;?>
                </div>
                <?php endif;?>
        </div>

语句如上,请问$image->primary代表什么,$primary->filename有代表什么意思呢,为什么显示不了图片呢。多谢大侠。



流浪的乞丐 发表于 2011-11-29 15:47:08

建议看看数据库类 result()和result_array()的差别~~

thenbsp 发表于 2012-1-12 11:00:06

流浪的乞丐 发表于 2011-11-29 15:47 static/image/common/back.gif
建议看看数据库类 result()和result_array()的差别~~

强烈同意。。。
页: [1]
查看完整版本: 请教view视图中语句含义