I have created a blog script with php i have also created an admin area, in the admin area it has a text box with a submit button, what happens is i type some text into the text box and press the submit code then it generates a text file into a folder, in the main index file i have put come php code that displays all the text files into a div, but i want to style the text files i have tryed many ways to style the text files without editing the text files themselves, any ideas? i can change the text files to .html or .doc, here is a link with the php files
Use div tag with class attribute to style your .txt file
<?php
foreach (glob("posts/*.txt") as $file) {
$file_handle = fopen($file, "r");
echo "<div class='styleTxt'>";
while (!feof($file_handle)) {
$line = fgets($file_handle);
echo $line;
}
echo "</div>";
fclose($file_handle);
} ?>
<?php
foreach (glob("posts/*.txt") as $file) {
$file_handle = fopen($file, "r");
$content="<div class='yourdesiredstyleclass'>";
while (!feof($file_handle)) {
$line = fgets($file_handle);
$content.='<div class="your style class for line">';
$content.= $line;
$content.="</div>";
}
$content.="</div>";
echo $content ;
fclose($file_handle);
}
?>
you can apply style to each word also by printing word with style also you can apply style to each character by printing character with style.