• User Attivo

    aiutino php

    Salve a tutti,
    sono a digiuno di php e mi servirebbe un aiutino, il codice che riporto soto alla fine mi da il risultato immagine e sotto titolo, io invece desidererei che mi facesse una piccola tabella con immagine, titolo e vedi dettagli...

    // Start page
        
        
        function startPage($IMAGE_URL,$IMAGE_PATH,$site_area){
        
                $CAT_DATA             = $this->get_cat_data();
                $db_name             = $CAT_DATA
    ;
                $IMAGE_URL            = "$IMAGE_URL" . $CAT_DATA[image_url];
                $IMAGE_PATH            = "$IMAGE_PATH". $CAT_DATA[image_path];
                $Main_Cat_ID        = $_GET[mid];
                
    
                $param1            = '3';          // level?
                $param2            = $site_area;  // area?
                $order_col_art     = 'time';
    
    
                $items             = '<table class = "startPage_table"><tr>';
                $items_db         = db::select_startpage($db_name, $param1, $param2, $order_col_art);
                $article_num     = mysql_num_rows($items_db);
                 
    
                $width_table_main     = 560;
                $columns             = 3;
                $rows                 = $article_num / $columns;
                $thumb_start_width    = $width_table_main / $columns;
                $thumb_start_width    = round ($thumb_start_width,0);
                $col_width             = $thumb_start_width;
    
    
    
                for ($i = 1, $a = 0; $a < $article_num; $i++,  $a++ ){
    
                        $item_ID     = mysql_result($items_db,$a,"item_ID");
                        $title         = mysql_result($items_db,$a,"title");
                        $picture_1    = mysql_result($items_db,$a,"picture_1");
                        $picture_2     = mysql_result($items_db,$a,"picture_2");
                        $picture_3     = mysql_result($items_db,$a,"picture_3");
    
                        $size         = getimagesize("{$IMAGE_PATH}{$picture_1}");
                        $img_width     = $size[0];
                        $img_height    = $size[1];
    
                               if ($img_width > $thumb_start_width){
    
                                    $img_ratio     = $img_width/$thumb_start_width;
                                    $thumb_height  = $img_height/$img_ratio;
                                    $thumb_height  = round ($thumb_height,0);
                                    $thumb_width    = $thumb_start_width;
    
                               }
                               else{
                                    $thumb_width     = $img_width;
                                    $thumb_height  = $img_height;
    
                               }
    
    
                            $items .= "
                            <td class = 'items_start' width='$col_width' valign='top'>
                            <div align='center'>
                            <a style='text-decoration: none;' class='navi'
                            href='index.php?cmd=details&mid=$Main_Cat_ID&aid=$item_ID'>
                                $title
                                <br/>
                                <img src='{$IMAGE_URL}{$picture_1}' width='$thumb_width'
                                   height='$thumb_height' border='0' alt='$title' />
                                </a>
                                </div>
                                </td>
                            ";
    
    
                            $modulus = $i % $columns;
                            if (($modulus == 0) && ($i != 0)){
                              $items .= '</tr><tr>';
                              }          
                }
                $items     .= '</tr></table>';    
        
        return $items;
        }
    
        
    
    

    sotto un esempio di come la vorrei:

    $items_cat .= "
    
                           <table class = 'cat_item'>
                             <tr>
                             <td>
                           <a  href='index.php?cmd=details&mid={$Main_Cat_ID}&aid={$item_ID}'>
                          <img  src='{$IMAGE_PATH}{$picture_1}' width='$thumb_width'
                           height='$thumb_height' border='0'  alt='$title' />
                           </a>
    
                             </td>
                             <td valign='top'>
    
                                 <a class='navi' href='index.php?cmd=details&mid={$Main_Cat_ID}&aid={$item_ID}'>
                                 $title
                                 </a>
                                 <br/><br/>
                                <a class='see_details' href='index.php?cmd=details&mid={$Main_Cat_ID}&aid={$item_ID}'>
                                  See details
                                  </a>
    
                             </td>
                        <td>
                           $site_currency {$price}
                           </td>
                             </tr>
                             </table>
    
    
    

    vi ringrazio anticipatamente