ciao a tutti.
Ho applicato un blog su un sito e ora stò cercando di far funzionare la pagina di ricerca.

la funzione che viene richiamata è la seguente:
Codice PHP:
function chop_text($posttext$minimum_length$length_offset) {
   
// The approximate length you want the concatenated text to be
   //$minimum_length = 260;
   // The variation in how long the text can be
   // in this example text length will be between 200-10=190 characters
   // and the character where the last tag ends
   //$length_offset = 10;
   // Reset tag counter & quote checker
   
$tag_counter 0;
   
$quotes_on FALSE;
   
// Check if the text is too long
   
if (strlen($posttext) > $minimum_length) {
       
// Reset the tag_counter and pass through (part of) the entire text
       
for ($i 0$i strlen($posttext); $i++) {
           
// Load the current character and the next one
           // if the string has not arrived at the last character
           
$current_char substr($posttext,$i,1);
           if (
$i strlen($posttext) - 1) {
               
$next_char substr($posttext,$i 1,1);
           }
           else {
               
$next_char "";
           }
           
// First check if quotes are on
           
if (!$quotes_on) {
               
// Check if it's a tag
               // On a "<" add 3 if it's an opening tag (like <a href...)
               // or add only 1 if it's an ending tag (like </a>)
               
if ($current_char == "<") {
                   if (
$next_char == "/") {
                                       
$tag_counter++;
                   }
                   else {
                       
$tag_counter $tag_counter 3;
                   }
               }
               
// Slash signifies an ending (like </a> or ... />)
               // substract 2
               
if ($current_char == "/"$tag_counter $tag_counter 2;
               
// On a ">" substract 1
               
if ($current_char == ">"$tag_counter--;
               
// If quotes are encountered, start ignoring the tags
               // (for directory slashes)
               
if ($current_char == "\""$quotes_on TRUE;
           }
           else {
               
// IF quotes are encountered again, turn it back off
               
if ($current_char == "\""$quotes_on FALSE;
           }

                           
           
// Check if the counter has reached the minimum length yet,
           // then wait for the tag_counter to become 0, and chop the string there
           
if ($i $minimum_length $length_offset && $tag_counter == 0) {
              
// Ensure complete word is display & not partial... search for space
              
$nospace true;
              while ( 
$nospace ) {
              if ( 
substr($posttext,$i,1) != " ")
               {   
$i++;
               }
               else {  
$nospace false; }
              }
               if ( 
substr($posttext,$i+1,1) == "/") {   $i=$i+2;   }
               
$posttext substr($posttext,0,$i 1) . "...";
               return 
$posttext;
           }
       }
   }
             return 
$posttext;

la riga che richiama la funzione è :
Codice PHP:
$message chop_text($message50050)."
....<a class=\"std\" href=\""
.$_SERVER['PHP_SELF']."?mode=viewid&amp;post_id=".$row['post_id']."\">Continue</a>"
Modificando il tempo di offset e la lunghezza della stringa che va a controlare riesco a far apparire il mesasggio di errore "dato non trovato" anche se il dato probabilmente esiste, ma è situato in una porzione di testo che non viene controllata, ma nel caso in cui ricerchi la parola "email" lo script va in timeoute mi dà:
Fatal error: Maximum execution time of 30 seconds exceeded in ...\function.php on line 650
che corrisponde alla riga :
Codice PHP:
 if ($i $minimum_length $length_offset && $tag_counter == 0) {
              
// Ensure complete word is display & not partial... search for space
              
$nospace true;
              while ( 
$nospace ) {
              if ( 
substr($posttext,$i,1) != " "//<--riga 46
               
{   $i++;
               }
               else {  
$nospace false; }
              }  
//<-- riga 50 della pagina 
Cambiando il valore di offset con cui effettuo la ricerca e il valore della stringa su ui effettua la ricerca cambia la riga di errore.
precedentemente era 10 il tempo di offset e l'errore lo dava sulla riga 46
Chi sa darmi un consiglio su come risolvere??