AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   read_file read all (https://forums.alliedmods.net/showthread.php?t=153762)

urban_ninja 03-28-2011 18:12

read_file read all
 
I'm trying to write a plugin that will read whole .txt files and all its contents and convert the .txt file content into .html or .htm for the web but my problem is read_file and write_file obligates you to specify a const text.
How do I set it so that it reads and write the whole line not just a specific position on the line?

Heres a general concept of what im trying to do:

Reads each line in a text file

filename.txt
Code:

Content line 1
Content line 2
Content line 3
Content line 4
...and so on down the lines

The takes what it got from the filename.txt and rewrites it into a web based (htm or html) file filename.htm

HTML Code:

</head>
<body bgcolor="#000000">
<p><font color="#d50000">Content line 1</font></p>
<p><font color="#d50000">Content line 2</font></p>
<p><font color="#d50000">Content line 3</font></p>
<p><font color="#d50000">Content line 4</font></p>
<p><font color="#d50000">...and so on down the lines</font></p></body></html>

The direct purpose behind this is to have an alternative to web base content from amx mod x with out the need to set up sql databases. Most game server providers offer a fast redirect service for fast DL straight from your local game server files and I want to use it to its full potential and have maybe web based ranking systems with out mysql databases of any sort. I already have added an .htm file is viewable in my browser and all I need is my amxx plugin to read stored content by other plugins and copy each line to a browsable .htm

Exolent[jNr] 03-28-2011 18:40

Re: read_file read all
 
https://forums.alliedmods.net/showthread.php?t=46218

fysiks 03-28-2011 18:42

Re: read_file read all
 
It should be fairly simple. Write header content in .html file, read from txt file, format with HTML, write formated text to .html file, repeat, write footer html.


All times are GMT -4. The time now is 14:36.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.