|
|
|
I looked everywhere for code that would take multiple text files and do
simple formatting on them and add them to a webpage. I ended up writing
one myself. The premise is simple, I needed a way for the monkeys hitting
the keys to easily add to the company webpage news section. Writing HTML
was DEFINATELY out, so I have them create a simple text file in windows
notepad and save it to a share drive. The code looks at the share drive,
gets the filenames, reads each file and formats the text - All on the fly.
NEATO FEATURES:
1. Totally self-maintaining: Instantly reads new news on the fly and when the
monkeys want it off the news section, they just delete the text file.
2. By using the ls command with -t, it automatically puts the newest news item
first, without a ton of extra code. Also, ls allows you to look at multiple
extensions and directories at the same time.
3. It can read from any mounted drive: works with Novell, Samba, NFS, Apple..
Text file format(I use):
First line is department,
second line blank,
third line is title,
fourth line blank,
fifth line and on is the news...
Steven S. Boger
sboger@hotmail.com
email me if you have questions
<HTML>
<BODY>
<center>
Department News
<br><br><br>
<table width="90%" border="0" cellspacing="0" cellpadding="10">
<?php
exec( "/bin/ls -t /mnt/novell/EVERYONE/news/*.txt /mnt/novell/EVERYONE/news/*.TXT",$s);
for ($p = 0;$p < count($s);$p++) {
echo "<TR bgcolor=\"#D0D0D0\"><TD>\n";
$file = file( "$s[$p]");
for($i = 0;$i < count($file);$i++) {
if ($i == 0) {
echo "<font size=\"+1\">$file[$i]</font><BR>\n";
} elseif ($i == 2) {
echo "<font size=\"+2\">$file[$i]</font></td></tr><TR BGCOLOR=\"#E0E0E0\"><td>\n";
} else {
echo "$file[$i]<BR>\n";
}
}
echo "</td></tr><TR><TD><br></TD></TR>\n";
}
?>
</table></center>
</BODY>
</HTML>
|
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Prints a bar of links to each HTML page it finds in the current directory, using the <TITLE> tag for the name of each link Categories : HTML, Filesystem, PHP | | | color codes for positive and negative numbers Categories : PHP, MySQL, Databases, HTML | | | PHP based Contact email form with multiple recipients, text file based, supports departments. Categories : PHP, Email, Beginner Guides, Filesystem | | | Parses HTTP_USER_AGENT so that you can customize your site to different browsers Categories : HTML, PHP, Complete Programs | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | Display list of files within current and subdirectories (recursively) showing
each file as an anchored link and each directory as a category header. Categories : Filesystem, Directories, Arrays, PHP | | | FormWizard reads a mysql table and generates automatically
a html formular in a html-table Categories : PHP, MySQL, HTML | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | The toll booth Categories : PHP, Java Script, Filesystem | | | php jump urls...the best way Categories : PHP, URLs, Filesystem | | | Simple way to replace a variable value in a .conf (.ini) file using a
webbrowser - the first stage of a complete universal configuration editor Categories : PHP, Regexps, Code Editors, Filesystem | | | File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection. Categories : Complete Programs, Content Management, Filesystem, PHP | | | GuestBook Light - a plug and play application for any website. Categories : PHP, Complete Programs, Filesystem, Sessions | | | Browser Detecor Class Categories : PHP Classes, PHP, HTML | |
|
|
|