Connecting Tech Pros Worldwide Forums | Help | Site Map

How to design the newsline

OllimaX
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi all you fine people!

I'm rather fresh in php and I'm designing webpages for a local sportsclub.
I have to design a way to print latest information on the frontpage, like
about 'Note that Tonight's Rambo Excercise for Kids takes place at the
sportsfield if the weather allows - Susanna"
My idea is that several people would update these lines, and that there
would be e. g. five latest messges visible.
Limiting the size of a message might be a good idea. Pages are in finnish,
and we need to use some extended characters, like ä etc.
I was thinmking that there would be a form, where certain people could
leave a message. The message would be added at the end of the file
'news.txt', the date and time of the message would be saved in the same
file as well. Then there would be a script thet reads the text until the
sixth date would be encountered, and prints each message on the frontpage.
I thought I would even use <pre class="message"></pre> markup if necessary.

Does anyone have any suggestions on how to do it? Is it wise to use one
file and append all messages to it? I have heard the fopen() and other
filefunctions are generally rather slow, although the traffic won't be very
busy on this site.
Does anyone have a better way to choose for me? I have no need to set up
any database solution for this.


Oll¡maX!

--
email : ollimantyranta"boing"sunpoint"boing"net
Tim Van Wassenhove
Guest
 
Posts: n/a
#2: Jul 17 '05

re: How to design the newsline


On 2004-01-20, OllimaX <ollimantyranta@example.com> wrote:[color=blue]
> Hi all you fine people!
>
> I have to design a way to print latest information on the frontpage, like
> about 'Note that Tonight's Rambo Excercise for Kids takes place at the
> sportsfield if the weather allows - Susanna"[/color]
[color=blue]
> My idea is that several people would update these lines, and that there
> would be e. g. five latest messges visible.[/color]
[color=blue]
> leave a message. The message would be added at the end of the file
> 'news.txt', the date and time of the message would be saved in the same
> file as well. Then there would be a script thet reads the text until the
> sixth date would be encountered, and prints each message on the frontpage.
> I thought I would even use <pre class="message"></pre> markup if necessary.[/color]

This is the way i would do it: (Avoiding searching latest 5 message in a
file etc)

Assuming you have already x posts in a file:
allposts.txt

Store the last 5 most recent posts in a file:
x+4.txt x+3.txt x+2.txt x+1.txt x.txt
(Say you already 10 posts, the files would be 14.txt, 13.txt, ...
10.txt)

Now each time a post is added, append it to allposts.txt and put it in a
file called x+6.txt. Remove the file x.txt

Next time a post is added, append it to allposts.txt and put it in a
file called x+7.txt. Remove the file x+1.txt
(In general: remove the x-5th file)


To show the most recent posts, instead of searching in allposts.txt just
display the 5 txt files ;)



--
http://home.mysth.be/~timvw
OllimaX
Guest
 
Posts: n/a
#3: Jul 17 '05

re: How to design the newsline


Tim Van Wassenhove <euki@pi.be> kirjoitti 20 Jan 2004 14:06:25 GMT:
[color=blue]
> To show the most recent posts, instead of searching in allposts.txt just
> display the 5 txt files ;)
>
>[/color]
Thanks, I got what you mean.
--
email : ollimantyranta"boing"sunpoint"boing"net
Tim Van Wassenhove
Guest
 
Posts: n/a
#4: Jul 17 '05

re: How to design the newsline


On 2004-01-20, OllimaX <ollimantyranta@example.com> wrote:[color=blue]
> Tim Van Wassenhove <euki@pi.be> kirjoitti 20 Jan 2004 14:06:25 GMT:
>[color=green]
>> To show the most recent posts, instead of searching in allposts.txt just
>> display the 5 txt files ;)
>>
>>[/color]
> Thanks, I got what you mean.[/color]


When i come to think about it, don't make an allposts.txt file.

Just put each post in a file. This is much easier to update existing
posts etc too.

--
http://home.mysth.be/~timvw
Closed Thread