Okay, Satis. It appears to be question I can answer because I've done many similar things in CGI before. Also I now work on one Pollpage in pure PHP and I also do not know damny nothing of mysql so, we face with the same problems. (I think)
You didn't ask for making whole thing for you so, I'll be limited to giving some advices only.
If you search for some manual to learn howto this, I doubt you'll find something exact so easy. If you insist, I recommend you to do some textprocessing works in C/PHP (rather PHP directly).
This is not thing for placing on web. This is just model how it can look.
Satis, I must digress a bit to say you what are your BASE options.
0. I know php-mysql chain is more elegant way to do what you want. Well:
1. You can manage php to put all texts into one single txt file and then do update/edit/observation with PHP/HTML interface.(harder to make, easier to use)
2. You can make only your (old)news page php generators and add texts by simply adding new *.txt file into some directory.(easier to make, barely harder to use)
3. (After you make something) You should think about partial showing news (10 by 10 or n by n or all by all) on history page.
4. (After you make something) You should think about making manager for searching that thing. Like google.
5. (While you make something) You should think about following abstraction: Why 10 news on the top page? You should allow $n numbers on news on the first page. Others are in history. Simple. Just set $n to 5 and you have 5 news on the top page.
In data abstraction and working comfort, you can go far away from just this.
If you open *.tpl files in your XFile directory, you'll see they are pure HTML pieces of HTML pages. If you look better, you'll see they have some markers (like "{POST_MESSAGE}") in there on
keyplaces (like date, topic title, post contain etc. etc.)
So, purpose of templates are to divine forum pages to many easy-observing pieces. Marking keyplaces just make it many-purpose-thing. You can do the same:
1. Make main page tamplate. It, simplied, could looks like:
2. Make news piece template. It, simplied, could look like:
Notice I used symbol "#" for keyplaces marking. It is enough long for start. Also, I didn't marked "what is what" (date, time, contain, ...). Instead, I will assume any thing must have exact order in datafile. You have many ways to mark "what is what", but I'll give freedom to your imagination rather.
3. So, then you have to manage php to use these templates to present heap of files or database in one file you make. Here, you'll have one loop in the global domain (later, it can become function). It should send main page template BUT it also should replace symbol "#" with last 10 news. That can be done with one function. Let see:
That while is a bit ugly. I'm not sure if this equivalent will work in php (it works in C)
4. So, when we talks about sendnews(), that it more complicated thing.
First, there you have to open dbase and find 10 last entires (easy if all files are in one file) OR to find last 10 made files. You have much ways to do both of these things:
| | |
| Quote: (1) You can put each news in database between tags "`" and "`", or in one row or between two boundaries like "-------asdfvafe-vwa--------", ... . When you add news, you simple add new thing to the top of file and when snow news, you interpret top10. (when you show history, you show from 11-20,21-30, ...).
If you do this, have on your mind you must put date, time and title somewhere in news, maybe in some tag or between "`" and "`" or similar. | |
| | |
| | |
| Quote: (2) You can make one directory with very many files. One file is one news. Simple. I really do not know how to read date whes file is made or to get list of files in directory thru php without VERY slowness so, I'll leave that things to Pig if he will. If not, I'll search thru manual soon.
But, I have one solution for this without reading date of filemake or listing files of directory. You can name files like 1.txt, 2.txt, 3.txt, etc.
1.txt is oldest, 2.txt is newer, etc.
Then, you also have two ways: 1. When someone request page creating. Your PHP will search if exist 1.txt, 2.txt, ... and find last *.txt. Then they will send you (for ex.) 53.txt, ..., 44.txt. 2. You can make one file for keeping number of news. And then read from that file how last news is named. Don't forget to update it after any adding. | |
| | |
Second: So, you'll also have 1 template and 10 news. You have two-three-four ways.
Third: With recent algorithm, one news file (1.txt for ex.) should look:
You should think about overall standardization first.
That's all for start.
You can go mooore deeper into abstraction and comfort doings. When you finish it, moderating your site should be easy as in this forums. (either you manage database by yourself or let that to mysql)
As for the including, I think you should feel free to make how much levels (or line includes) you need.
Let me know if I can help you more.