• 26-08-2013, 17:56:26
    #1
    Merhabalar Arkadaşlar,
    Aşağıda yapmak istediğim 2. resmi varsa 2. resmi alsın yoksa 3. resmi alsın yoksa 4. resmi alsın yoksa 5.resmi alsın oda yoksa gitsin 1. resmi alsın. Ama nedense olmuyor bi türlü :S yardımcı olursanız sevinirim


    	<?php
    							$thumb2 = str_replace( '_1-304x444.jpg', '_2-304x424.jpg', $product['thumb'] );
    						if (file_exists($thumb2)) 
    							{
    							$thumb2 = str_replace( '_1-304x444.jpg', '_2-304x424.jpg', $product['thumb'] );
    							} 
    							else 
    							{
    								$thumb2 = str_replace( '_1-304x444.jpg', '_3-304x424.jpg', $product['thumb'] );
    								if (file_exists($thumb2)) 
    							{
    							$thumb2 = str_replace( '_1-304x444.jpg', '_3-304x424.jpg', $product['thumb'] );
    							} 
    							else 
    							{
    								$thumb2 = str_replace( '_1-304x444.jpg', '_4-304x424.jpg', $product['thumb'] );
    								if (file_exists($thumb2)) 
    							{
    							$thumb2 = str_replace( '_1-304x444.jpg', '_4-304x424.jpg', $product['thumb'] );
    							} 
    							else 
    							{
    								$thumb2 = str_replace( '_1-304x444.jpg', '_5-304x424.jpg', $product['thumb'] );
    							if (file_exists($thumb2)) 
    							{
    							$thumb2 = str_replace( '_1-304x444.jpg', '_5-304x424.jpg', $product['thumb'] );
    							} else 
    							{
    								$thumb2 = $product['thumb'];
    									}
    									}
    									}
    									}
    									
     ?>
  • 26-08-2013, 18:16:01
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    kodunuz biraz karmaşıktı tam yapıyı ve işleyişi görmeden bi' şey söyleyemeyiz.

    <?php
    	
    	$thumb2 = str_replace( '_1-304x444.jpg', '_2-304x424.jpg', $product['thumb'] );
    	
    	if(file_exists($thumb2))
    		$thumb2 = str_replace( '_1-304x444.jpg', '_2-304x424.jpg', $product['thumb'] );
    	else {
    		$thumb2 = str_replace( '_1-304x444.jpg', '_3-304x424.jpg', $product['thumb'] );
    		if(file_exists($thumb2))
    			$thumb2 = str_replace( '_1-304x444.jpg', '_3-304x424.jpg', $product['thumb'] );
    		else {
    			$thumb2 = str_replace( '_1-304x444.jpg', '_4-304x424.jpg', $product['thumb'] );
    			if(file_exists($thumb2))
    				$thumb2 = str_replace( '_1-304x444.jpg', '_4-304x424.jpg', $product['thumb'] );
    			else {
    				$thumb2 = str_replace( '_1-304x444.jpg', '_5-304x424.jpg', $product['thumb'] );
    				if(file_exists($thumb2))
    					$thumb2 = str_replace( '_1-304x444.jpg', '_5-304x424.jpg', $product['thumb'] );
    				else
    					$thumb2 = $product['thumb'];
    			}
    		}
    	}
  • 26-08-2013, 18:40:30
    #3
    $product['thumb']değerinde www.siteadresi.com/resim_1-304x444.jpg değeri geliyor

    istediğim ta olarak şu
    www.siteadresi.com/resim_2-304x444.jpg ( ikinci resim ) 2. resim var mı yok mu kontrol etsin var sa $thumb2 değerine www.siteadresi.com/resim_2-304x424.jpg olarak atasın eğer değilse 3. resme basın..vs 5 resme kadar gitsin eğer 5. resimde yok ise ilk değer olan $product['thumb'] yani www.siteadresi.com/resim_1-304x444.jpg değerini $thumb2 olarak versin