Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1

    anomalia su return"$valore";

    arrivo in fondo a una funzione e il return non mi restituisce nulla, mentre se immediatamente prima eseguo un print della solita variabile funziona tutto bene.

    cosa può essere?

    il valore della variabile è questo:
    [code]
    #left;a href=#double;#double;#right;#graphleft;#squareleft ;#roundleft;#double;d#single;catalogo ITA à?!#double;#roundright;#squareright;#graphright;#l eft;#slash;a#right; #slash; #left;a href=#double;#double;#right;cat#graphleft;#squarel eft;#roundleft;#double;d#single;alta qualità?!#double;#roundright;#squareright;#graphri ght;#left;#slash;a#right; #slash; #left;a href=#double;#double;#right;sub cat #graphleft;#squareleft;#roundleft;#double;d#single ;alta qualità?!#double;#roundright;#squareright;#graphri ght;#left;#slash;a#right; ciccia
    [code]

    perchè non piace al return?
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

  2. #2

  3. #3
    codice:
    function cat_path($category_id,$language_short,$path_string)
    {	
    	if(isset($category_id) and $category_id!="" and ereg("^[0-9]{1,}$","$category_id") AND isset($language_short) and $language_short!="" and ereg("^[A-Z]{2,3}$","$language_short")) 
    	{
    						
    		//set site setting page_title and body manually for login
    		$setSiteDb=connect();
    		
    		$nameString="name_$language_short";
    		$output="";
    		
    		if(isset($path_string) and $path_string!="")
    		{			
    			if(ereg("^[;#&A-Za-z0-9_ -=]{1,}$","$path_string"))
    			{
    				$output="$path_string";
    			}
    			else hack("errore var path_string da funzione cat_path");		
    		}
    					
    		$queryCategory="SELECT * FROM catalogs_categories WHERE id='$category_id'";
    		$resultCategory = $setSiteDb->query("$queryCategory");
    		$rowCategory = $resultCategory->fetch_assoc();
    		
    		$category_mother_id="";
    		
    		if(ereg("^[0-9]{1,}$","$rowCategory[category_id]")) 
    		{
    			$category_mother_id="$rowCategory[category_id]";
    			
    			if("$category_mother_id"=="0")
    			{
    				if(ereg("^[0-9]{1,}$","$rowCategory[catalog_id]")) 
    				{				
    					$catalog_id="$rowCategory[catalog_id]";
    					$queryCatalog="SELECT * FROM catalogs WHERE id='$catalog_id'";
    					$resultCatalog = $setSiteDb->query("$queryCatalog");
    					$rowCatalog = $resultCatalog->fetch_assoc();
    					
    					if(ereg("^[;#&A-Za-z0-9_ -]{1,}$","$rowCatalog[$nameString]"))
    					{					
    						if(ereg("^[;#&A-Za-z0-9_ -]{1,}$","$rowCategory[$nameString]"))
    						{
    							$value="#left;a href=#double;#double;#right;$rowCatalog[$nameString]#left;#slash;a#right; #slash; #left;a href=#double;#double;#right;$rowCategory[$nameString]#left;#slash;a#right; $output ";
    							print"
    
    $value</p>";
    							$value=lev_decript("$value");
    							print"
    
    $value</p>";
    							
    							return"$value";
    						}
    						else hack("errore var $nameString da databased tab catalogs_categories");
    					}
    					else hack("errore var $nameString da database tab catalogs");
    				}
    				else hack("errore var catalog_id da database tab catalogs_categories");	
    			}
    			else
    			{
    				if(ereg("^[;#&A-Za-z0-9_ -=]{1,}$","$rowCategory[$nameString]"))
    				{
    					$output="#slash; #left;a href=#double;#double;#right;$rowCategory[$nameString]#left;#slash;a#right;"." $output";
    					
    					cat_path("$category_mother_id","$language_short","$output");
    				}
    				else hack("errore var $nameString da database tab catalogs_categories");
    			}		
    		}
    		else hack("errore var details_id da funzione cat_path ");
    	}
    }
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

  4. #4

  5. #5
    fa un replace dei caratteri scomodi, ecc

    quelli che vedi come #double; in realtà è un " #single; è ' #left; < slash: #slash;
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

  6. #6

  7. #7
    se eseguo un print al posto dell'ultimo return, sia che io stampi la viariabila passata da lev_decript che no, stampa regolarmente l'output. è il retun che non fa niente sena dare errore
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

  8. #8
    codice:
    function lev_decript($string)
    {
    	if (lev_check($string))
    	{
    		$newstring = $string;
    		$newstring= str_replace("#double;","\"","$newstring"); 
    		$newstring= str_replace("#single;","'","$newstring"); 
    		$newstring= str_replace("#left;","<","$newstring"); 
    		$newstring= str_replace("#right;",">","$newstring"); 
    		$newstring= str_replace("#dpoint;",":","$newstring"); 
    		$newstring= str_replace("#slash;","/","$newstring");
    		$newstring= str_replace("#roundleft;","(","$newstring"); //replace / with #roundleft;
    		$newstring= str_replace("#roundright;",")","$newstring"); //replace / with #roundright;
    		$newstring= str_replace("#squareleft;","[","$newstring"); //replace / with #squaredleft;
    		$newstring= str_replace("#squareright;","]","$newstring"); //replace / with #squareright;
    		$newstring= str_replace("#graphleft;","{","$newstring"); //replace / with #graphleft;
    		$newstring= str_replace("#graphright;","}","$newstring"); //replace / with #graphright;
    		return"$newstring";
    	}
    	else hack("Errore nella in lev_decript la viariabile conteneva caratteri non validi prima della codifica");
    }
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

  9. #9
    Posta il codice di lev_check().

    Comunque, a me questo codice funziona perfettamente:

    Codice PHP:
    <?php 
    function lev_decript($string) {
        return 
    $string;
    }

    function 
    test() {
        
    $nameString 'test';
        
    $rowCatalog  'test';
        
    $rowCategory  'test';
        
    $output  'test';

        
    $value="#left;a href=#double;#double;#right;$rowCatalog[$nameString]#left;#slash;a#right; #slash; #left;a href=#double;#double;#right;$rowCategory[$nameString]#left;#slash;a#right; $output ";
        print
    "1. 

    $value</p>";
        
    $value=lev_decript("$value");
        print
    "2. 

    $value</p>";
        
        return
    "$value";
    }

    $value test();
    print
    "3. 

    $value</p>";

    ?>

  10. #10
    no guarda, lev_check non centra (come lev_decript)

    si tratta di un cms, le funzioni lev_decript lev_cript e lev_check le uso regolarmente da mesi e mesi di sviluppo.

    ho due categorie in database una settata con cataogy_id=0 (quindi sulla root del catalogo) e con id=3

    l'altra con category_id=3 e id=4

    se richiamo la funzione sulla categoria con id=3 (quindi non fa la ricorsione) tutto ok

    se chiamo su id=4 quando fa la ricorsione accade qualcosa che non fa stampare nulla.

    questi sono i valori, lo so che sono strani, ma voglio che si possano inserire nomi di categoria tipo 'scarpe di qualità "nike" ! (uomo)', per fare un esemepio.

    id=3
    category_id=0 (root)
    name_IT= cat#graphleft;#squareleft;#roundleft;#double;d#sin gle;alta qualit&agrave;&#63;&#33;#double;#roundright;#squar eright;#graphright;

    l'altra

    id=4
    category_id=3 (sotto categoria)
    name_ENG= sub cat #graphleft;#squareleft;#roundleft;#double;d#single ;alta qualit&agrave;&#63;&#33;#double;#roundright;#squar eright;#graphright;
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.