Originariamente inviato da ghiacciato
function mia_funzione()
{blablabal..}
for(0;20;+1)
{
}
invece di:
for(0;20;+1)
{
function mia_funzione()
{blablabal..}
}
chiaro?!?
Non funziona
Posto il codice
Codice PHP:
$maxlength = 150;
$extension = " ...";
function truncate_string ($maintext, $maxlength, $extension) {
// Set the replacement for the "string break" in the wordwrap function
$cutmarker = "**cut_here**";
// Checking if the given string is longer than $maxlength
if (strlen($maintext) > $maxlength) {
// Using wordwrap() to set the cutmarker
// NOTE: wordwrap (PHP 4 >= 4.0.2, PHP 5)
$maintext = wordwrap($maintext, $maxlength, $cutmarker);
// Exploding the string at the cutmarker, set by wordwrap()
$maintext = explode($cutmarker, $maintext);
// Adding $extension to the first value of the array $string, returned by explode()
$maintext = $maintext[0] . $extension;
}
// returning $string
return $maintext;
}
$maintext_sub = truncate_string($maintext, $maxlength, $extension);
$maintext l'ho già definito.
Io ho provato a mettere il tuo codice in tutte e due le posizioni che mi hai detto, ma non va, c'è un rallentamento quando si prova a caricare la pagina e poi mi arriva questo messaggio:
Non vorrei risultare assillante maleducato, ma vorrei chiedervi come si fà ad aggirare questo cavolo di problema? Ho cercato sia sul forum che in rete, ma non ho trovato niente, a parte il consigliodi usare require_once e include_once, ci ho provato , ma mi mette solo un estratto per tutti gli headlines...AIUTO!!!!