• 04-09-2010, 12:36:30
    #1
    Aşağıda verdiğim kodda da göründüğü gibi, resim eklemeyince no-image-large1.png adlı resim dosyası görünüyor. bense resim eklemeyince hiçbir şey gözükmesin istiyorum. bunu nasıl sağlayabilirim ?

     
    if ($row['pd_image3']) {
    $row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];
    } else {
    $row['pd_image3'] = WEB_ROOT . 'images/no-image-large1.png';
    }
  • 04-09-2010, 12:46:04
    #2
    Üyeliği durduruldu
    bu kodun tasarımsal kısmının da burada olduğunu farzedelim

    if ($row['pd_image3']) {
    echo "<img src="$row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];" />";
    } else {
    //boş bıraktığında tasarım içinde resim falan göstermez ama işte işin tasarımsal kısmı da lazım bunun gibi bir örneğe detaylı yardım verebilmek için
    }
  • 04-09-2010, 13:09:23
    #3
    ifle kontorol etmek yerine veri tabanında varsayılan deger atamanız daha iyi olurdu
    performans acısından da
  • 04-09-2010, 13:35:21
    #4
    izmirden adlı üyeden alıntı: mesajı görüntüle
    bu kodun tasarımsal kısmının da burada olduğunu farzedelim

    if ($row['pd_image3']) {
    echo "<img src="$row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];" />";
    } else {
    //boş bıraktığında tasarım içinde resim falan göstermez ama işte işin tasarımsal kısmı da lazım bunun gibi bir örneğe detaylı yardım verebilmek için
    }
    yardımınız için çok teşekkürler ama ne yazık ki bu kod istediğim sonucu vermedi. kodların tamamını atıyorum :

    <?php
    require_once 'config.php';
    
    /*********************************************************
    *                 PRODUCT FUNCTIONS 
    **********************************************************/
    
    
    /*
        Get detail information of a product
    */
    function getProductDetail($pdId)
    {
        
        $_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI'];
        
        // get the product information from database
        $sql = "SELECT pd_name, pd_description, pd_price, pd_image, pd_image2, pd_image3, pd_image4, pd_qty
                FROM tbl_product
                WHERE pd_id = $pdId";
        
        $result = dbQuery($sql);
        $row    = dbFetchAssoc($result);
    
        extract($row);
        
        $row['pd_description'] = nl2br($row['pd_description']);
        
        if ($row['pd_image']) {
            $row['pd_image'] = WEB_ROOT . 'images/product/' . $row['pd_image'];
        } else {
            $row['pd_image'] = WEB_ROOT . 'images/no-image-large1.png';
        }
    
    if ($row['pd_image2']) {
            $row['pd_image2'] = WEB_ROOT . 'images/product/' . $row['pd_image2'];
        } else {
            $row['pd_image2'] = WEB_ROOT . 'images/no-image-large1.png';
        }
    
    if ($row['pd_image3']) {
            $row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];
        } else {
            $row['pd_image3'] = WEB_ROOT . 'images/no-image-large1.png';
        }
    
        if ($row['pd_image4']) {
            $row['pd_image4'] = WEB_ROOT . 'images/product/' . $row['pd_image4'];
        } else {
    
                    $row['pd_image4'] = WEB_ROOT . 'images/no-image-large1.png';
                    
            
        }
    
        
        return $row;            
    }
    
    
    
    ?>
  • 04-09-2010, 13:36:58
    #5
    Üyeliği durduruldu
    Söylemek istediğim şuydu şayet resim yok ise bunu göstermemesi için gerekli olan sistemi yalnızca bu kodlardan yapazsın tasarım kısmının da kodları gerekli
  • 04-09-2010, 14:17:31
    #6
    WarezeBaksana adlı üyeden alıntı: mesajı görüntüle
    yardımınız için çok teşekkürler ama ne yazık ki bu kod istediğim sonucu vermedi. kodların tamamını atıyorum :

    <?php
    require_once 'config.php';
    
    /*********************************************************
    *                 PRODUCT FUNCTIONS 
    **********************************************************/
    
    
    /*
        Get detail information of a product
    */
    function getProductDetail($pdId)
    {
        
        $_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI'];
        
        // get the product information from database
        $sql = "SELECT pd_name, pd_description, pd_price, pd_image, pd_image2, pd_image3, pd_image4, pd_qty
                FROM tbl_product
                WHERE pd_id = $pdId";
        
        $result = dbQuery($sql);
        $row    = dbFetchAssoc($result);
    
        extract($row);
        
        $row['pd_description'] = nl2br($row['pd_description']);
        
        if ($row['pd_image']) {
            $row['pd_image'] = WEB_ROOT . 'images/product/' . $row['pd_image'];
        } else {
            $row['pd_image'] = WEB_ROOT . 'images/no-image-large1.png';
        }
    
    if ($row['pd_image2']) {
            $row['pd_image2'] = WEB_ROOT . 'images/product/' . $row['pd_image2'];
        } else {
            $row['pd_image2'] = WEB_ROOT . 'images/no-image-large1.png';
        }
    
    if ($row['pd_image3']) {
            $row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];
        } else {
            $row['pd_image3'] = WEB_ROOT . 'images/no-image-large1.png';
        }
    
        if ($row['pd_image4']) {
            $row['pd_image4'] = WEB_ROOT . 'images/product/' . $row['pd_image4'];
        } else {
    
                    $row['pd_image4'] = WEB_ROOT . 'images/no-image-large1.png';
                    
            
        }
    
        
        return $row;            
    }
    
    
    
    ?>
    Böyle deneyin bakalım:

    <?php
    require_once 'config.php';
    
    /*********************************************************
    *                 PRODUCT FUNCTIONS 
    **********************************************************/
    
    
    /*
        Get detail information of a product
    */
    function getProductDetail($pdId)
    {
        
        $_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI'];
        
        // get the product information from database
        $sql = "SELECT pd_name, pd_description, pd_price, pd_image, pd_image2, pd_image3, pd_image4, pd_qty
                FROM tbl_product
                WHERE pd_id = $pdId";
        
        $result = dbQuery($sql);
        $row    = dbFetchAssoc($result);
    
        extract($row);
        
        $row['pd_description'] = nl2br($row['pd_description']);
        
        if ($row['pd_image']) {
            $row['pd_image'] = WEB_ROOT . 'images/product/' . $row['pd_image'];
        } else {
            echo '';
        }
    
    if ($row['pd_image2']) {
            $row['pd_image2'] = WEB_ROOT . 'images/product/' . $row['pd_image2'];
        } else {
           echo '';
        }
    
    if ($row['pd_image3']) {
            $row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];
        } else {
            echo '';
        }
    
        if ($row['pd_image4']) {
            $row['pd_image4'] = WEB_ROOT . 'images/product/' . $row['pd_image4'];
        } else {
            echo '';    
        }  
        return $row;            
    }
    
    
    
    ?>
  • 04-09-2010, 14:21:03
    #7
    Üyeliği durduruldu
    SoutH adlı üyeden alıntı: mesajı görüntüle
    Böyle deneyin bakalım:

    <?php
    require_once 'config.php';
    
    /*********************************************************
    *                 PRODUCT FUNCTIONS 
    **********************************************************/
    
    
    /*
        Get detail information of a product
    */
    function getProductDetail($pdId)
    {
        
        $_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI'];
        
        // get the product information from database
        $sql = "SELECT pd_name, pd_description, pd_price, pd_image, pd_image2, pd_image3, pd_image4, pd_qty
                FROM tbl_product
                WHERE pd_id = $pdId";
        
        $result = dbQuery($sql);
        $row    = dbFetchAssoc($result);
    
        extract($row);
        
        $row['pd_description'] = nl2br($row['pd_description']);
        
        if ($row['pd_image']) {
            $row['pd_image'] = WEB_ROOT . 'images/product/' . $row['pd_image'];
        } else {
            echo '';
        }
    
    if ($row['pd_image2']) {
            $row['pd_image2'] = WEB_ROOT . 'images/product/' . $row['pd_image2'];
        } else {
           echo '';
        }
    
    if ($row['pd_image3']) {
            $row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];
        } else {
            echo '';
        }
    
        if ($row['pd_image4']) {
            $row['pd_image4'] = WEB_ROOT . 'images/product/' . $row['pd_image4'];
        } else {
            echo '';    
        }  
        return $row;            
    }
    
    
    
    ?>
    iyi ama bu şekilde resim olan kısım boş döner ve doğal olarak da ie de resim yeri çirkin durur
  • 04-09-2010, 14:24:46
    #8
    izmirden adlı üyeden alıntı: mesajı görüntüle
    iyi ama bu şekilde resim olan kısım boş döner ve doğal olarak da ie de resim yeri çirkin durur
    Sadece mantık. Arkadaş tasarımı da yazarsa uydururuz bir şeyler.
  • 04-09-2010, 14:26:31
    #9
    Üyeliği durduruldu
    izmirden adlı üyeden alıntı: mesajı görüntüle
    bu kodun tasarımsal kısmının da burada olduğunu farzedelim

    if ($row['pd_image3']) {
    echo "<img src="$row['pd_image3'] = WEB_ROOT . 'images/product/' . $row['pd_image3'];" />";
    } else {
    //boş bıraktığında tasarım içinde resim falan göstermez ama işte işin tasarımsal kısmı da lazım bunun gibi bir örneğe detaylı yardım verebilmek için
    }
    burda belirtmiştim boş bırakma mantığını saygılar