mm la butto li con dei file di testo:
Lo invii tramite form:(PS:lo allarghi a tuo piacimento o ci fai quello che vuoi)
Codice HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Invia.php</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<FORM METHOD="post" ACTION="salva.php">
<p> </p>
<p>
</p>
<table align="center">
<tr>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
Page:<br><textarea name="text"></textarea>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" name="sub" value="Invia"><input type="reset" name="res" value="Cancella">
</td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
poi salva.php
Codice PHP:
<?
$dir = "Pagina/";
$text = isSet($_POST['text']) ? $_POST['text'] : '';
$text = stripslashes($text);
$text = nl2br($text);
$fp = fopen($dir.$nome."Pagina.txt", "w");
fwrite($fp, " Pagina: ".$text);
fclose($fp);
echo"Pagina creata con successo";
?>
poi ovviamente crei la cartella Pagina ecc..
dove vuoi stamparla metti questo:
Codice PHP:
<?
$file = file("Pagina/Pagina.txt");
foreach($file as $riga) {
$words = explode(' ' , $text);
for($i=0 ; $i<count($words) ; $i++) {
// Link
$word[$i] = trim($word[$i]);
$var = isset($word[$i]{0}) ? strtolower($word[$i]{0}) : '';
$var .= isset($word[$i]{1}) ? strtolower($word[$i]{1}) : '';
$var .= isset($word[$i]{2}) ? strtolower($word[$i]{2}) : '';
$var .= isset($word[$i]{3}) ? strtolower($word[$i]{3}) : '';
if(trim($var) == 'http') {
$word[$i] = '<a href="'. $word[$i] .'">'. $word[$i] .'</a>';
} elseif(trim($var)=='www.') {
$word[$i] = '<a href="http://'. $word[$i] .'">'. $word[$i] .'</a>';
}
// Grassetto
$words[$i] = str_replace('[b]','<b>',$words[$i]);
$words[$i] = str_replace('[/b]','</b>',$words[$i]);
// Corsivo
$words[$i] = str_replace('[i]','<i>',$words[$i]);
$words[$i] = str_replace('[/i]','</i>',$words[$i]);
// Sottolineato
$words[$i] = str_replace('[u]','<u>',$words[$i]);
$words[$i] = str_replace('[/u]','</u>',$words[$i]);
// Immagini
if( strpos( $words[$i], '[img]' ) !== false && strpos( $words[$i], '[/img]' ) !== false) {
$link = str_replace('[img]','',$words[$i]);
$link = str_replace('[/img]','',$link);
$words[$i] = "<img src=\"$link\">";
}
}
$text = implode(' ', $words);
print($riga);
}
?>
Con questo che to messo sopra puoi anche mettere immagini testo sottolineato link ecc...
Per quanto riguarda il fatto che puoi aggiungere solo tu le news usa delle sessioni nella pagina del form,
saluti ang