Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Mostrare variabile contenuta in una funzione

    Premetto che, come purtroppo sempre mi capita, sono alle prese con un sito encodato con ioncube quindi per la maggior parte del tempo devo andare per tentativi e immedesimarmi nella mente del programmatore originale. Sia data questa funzione:

    Codice PHP:
    function Ti_Odio($display="") { 
    // tanto codice
    $content $return[content];

    Questa funzione fa 3 query. Alla fine delle query ritorna un valore in $content. Io voglio semplicemente mostrare questo valore in una pagina ma non c'è verso. Per farvi capire nemmeno se nella funzione inserisco "$mostrami = ciao;" in cima a tutto e fuori da ogni ciclo riesco a vedere il "ciao"

    Idee?

  2. #2
    Onestamente non capisco...

    Codice PHP:
    function Ti_Odio($display="") {  
    // tanto codice 
    $content $return[content]; 
    return 
    $content;
    }

    echo 
    Ti_Odio(); 
    http://www.miniscript.it
    Se ti sono stato di aiuto in qualche modo in questo forum iscriviti alla fan page di Miniscript - il mio blog di programmazione web.

  3. #3
    Eh no poi vengono fuori anche tutte le altre variabili contenute nella funzione

  4. #4
    continuo a non capirti... facci vedere la funzione e cosa vuoi ottenere come output da questa
    http://www.miniscript.it
    Se ti sono stato di aiuto in qualche modo in questo forum iscriviti alla fan page di Miniscript - il mio blog di programmazione web.

  5. #5
    Purtroppo è un pò lunghino. Io voglio $news_content. Ci sarebbe poi il discorso ioncube ma per il momento lo lascio da parte perchè magari non c'entra con il fatto che non riesco a ottenere la variabile.

    Codice PHP:
    function News_Display($display="")
    {
        
        global 
    $lang;
        
    $news_id $GLOBALS[newsid];
        if( (
    $news_id != 0)||($news_id != "") )
        { 
    $id_query " AND news_id=$news_id"; }else{ $all_news 'yes'; }
            
        
    $detect_entities_content = array("<",">",""","’","&");
        
    $change_entities_content = array("<",">",'"',"'","&");
        
        
    $number_results    mysql_result(mysql_query("SELECT COUNT(*) FROM phpkb_news WHERE news_show='yes' ".$GLOBALS['AND_Language_Query'].$id_query "$GLOBALS['connection']),0,0);
        if(
    $number_results 0)
        {
            if(
    $all_news == 'yes')
            {
                
    // Passing variables for paging file.
                
    $message_display_for_paging_file " news";
                
    $number_rows         $number_results;
                
    $current_pagename    "".$GLOBALS['path_kb']."/news.php";
                include(
    'include/paging.php'); // Including paging file.
                
    $Order_Limit_News "ORDER BY news_date_time DESC LIMIT $from,$range";
            }
            if(
    $display == 'Title') { $fetch_fields "news_title"; }
            else{ 
    $fetch_fields "news_id, news_title, news_content, author_id, news_date_time, news_hits"
                if(
    $id_query != "")mysql_query("UPDATE phpkb_news SET news_hits=news_hits+1 WHERE news_id=$news_id"$GLOBALS['connection']);
            }
            
            
    $fetch_query    "SELECT $fetch_fields FROM phpkb_news WHERE news_show='yes' ".$GLOBALS['AND_Language_Query'].$id_query $Order_Limit_News";

            
    //print $fetch_query;
            
    $query_results    mysql_query($fetch_query,$GLOBALS['connection']) or die("Could not execute the Fetching News Query.");
            while(
    $rec mysql_fetch_array($query_results))
            {
                if(
    $display == 'Title')
                {
                    
    $news_result stripslashes($rec[news_title]);
                }
                else
                {
                    
    $news_date            convert_date_time($rec[news_date_time],1,'b''at');
                    
    $news_link_string    makelink('news',$rec[news_id]);
                    
    $news_title            stripslashes($rec[news_title]);
                    
    $news_content        str_replace($detect_entities_content$change_entities_content$rec[news_content]);
                    
    $news_content        strip_tags(entities_detect_replace_reverse($news_content));
                    
    $news_content        substr($news_content,0,325)."...";

                    if(
    $GLOBALS['usefor'] == 'RSS')
                    {
                        
    $news_result .= "<item>
                                            <guid>
    $news_link_string</guid>
                                            <title>
    $news_title</title>
                                            <link>
    $news_link_string</link>
                                            <description><![CDATA[
    $news_content]]></description>\n
                                         </item>\n"
    ;
                    }
                    if(
    $id_query != "")
                    {
                        
    //$news_detail =  "Posted on: $news_date. This news has been viewed $rec[news_hits] times.";
                        
    $ps = array("%vd%""%cd%"); $rplcs = array("$rec[news_hits]""$news_date");
                        
    $news_detail str_replace($ps,$rplcs,$lang['news_full_info']);

                        
    $author_name mysql_result(mysql_query("SELECT author_name FROM phpkb_authors WHERE author_id=$rec[author_id]"),0,0);
                        
    $news_result .= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
                                            <tr><td class=\"article-title\"><h1>
    $news_title</h1></td></tr>
                                            <tr><td>"
    .str_replace($detect_entities_content$change_entities_contentstripslashes($rec[news_content]))."</td></tr>
                                            <tr>
                                                <td><p class=\"breadcrumb\">
    $news_detail</p></td>
                                            </tr>
                                        </table>"
    ;
                        
                    }
                    else{
                        
    //$news_detail =  "Published on: $news_date | Viewed: $rec[news_hits] times.";
                        
    $ps = array("%vd%""%cd%"); $rplcs = array("$rec[news_hits]""$news_date");
                        
    $news_detail str_replace($ps,$rplcs,$lang['news_info']);
                        
                        
    $news_content    str_replace(""," ",$news_content);
                        
    $news_result .= "[*]<a href=\"$news_link_string\" class=\"news-title\">$news_title</a>
                                         <div class=\"grey-text\">
    $news_detail</div>
                                         
    $news_content... <a href=\"$news_link_string\">".$lang['read_more_text']."</a>
                                          "
    ;
                    }
                }
            }
    // End Of While Loop
            
            
    if($all_news == 'yes')
            {
                
    $news_result "[list=1]$news_result[/list]";
                
    // Displaying Paging...
                
    if($number_results && $total_num_pages 1)
                { 
                    
    $news_result .= "<div class=\"categories\">
                                        <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
                                            <tr>
                                                <td align=\"left\" width=\"60%\">
    $message_displaying_records</td>
                                                <td align=\"right\">
    $paging_display</td>
                                            </tr>
                                        </table>
                                    </div>"
    ;
                } 
            
            }
            
            
    mysql_free_result($query_results);
        }else{
            
    $news_result .= "<div class=\"categories section-content\">
                                "
    .$lang['no_news_text']."
                             </div>"
    ;
            if(
    $GLOBALS['usefor'] == 'RSS'){ $news_result ""; }
        }
        return 
    $news_result;

    Ti ringrazio per la disponibilità

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.