Ciao!
Ho questo script php (lo posto tutto):
Codice PHP:
<?php
$var = array_reverse( file("./pag/DB_news.txt") );
?>
<?php
if (isset($_GET['pag'])){
$id=$_GET['id'];
if($id==0){
$id=1;
}
}else{$id=1;}
$mn=8;
$mn=$mn*2;
$zm=$id*$mn;
$zxm=$zm-$mn;
$xk=1;
$cnt=count($var);
for($i=$zxm;$i<$zm;$i++){
if ( trim($var[$i]) != "" ) {
$lista = explode("|",$var[$i]);
if($xk==1){
$xk=0;
}else{
$xk=1;
}
?>
<img src="<?php echo $lista[4]; ?>" alt="" width="70" height="70" align="left">
<h1><b>
<?php echo $lista[1]; ?>
</b></h1>
<p>Postato da:<b><?php echo $lista[2]; ?></b> il <i><?php echo $lista[3]; ?></i></p>
<p><br>
<?php echo $lista[5]; ?>
<?php
}
}
$npg=$cnt/$mn;
if(is_int($npg)){
$nxp=$npg;
}else{
settype($npg,"int");
$nxp=$npg+1;
}
?>
<br>
<br>
<p align="right">
<?php
for($x=1;$x<=$nxp;$x++){
echo "<a href=\"./?pag=home&id=$x\"> [$x] </a>";
}
?>
</p>
</p>
Dovrebbe prendere i valori da DB_news.txt così strutturato:
Codice:
1|Titolo|Nome|Data|images/avatar_maca.png|Testo da inserire ;)
Per fortuna tutto funziona ma purtroppo mi da 15 errori (notice) che non vorrei eliminare con un semplice Error_reporting ma in modo radicale:
Originalmente inviato da
errori_script
Notice: Undefined offset: 1 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 2 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 3 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 4 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 5 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 6 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 7 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 8 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 9 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 10 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 11 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 12 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 13 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 14 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20
Notice: Undefined offset: 15 in C:\Program Files\EasyPHP 2.0b1\www\wow\pag\home.php on line 20