Dynamic event list (simple)

C

chlori

I will have a list of events, like this:

<ul>
<li><a href="link1.php">Event1 2004-12-01</a></li>
<li><a href="link2.php">Event2 2005-01-01</a></li>
<li><a href="link3.php">Event3 2005-02-01</a></li>
<li><a href="link4.php">Event4 2005-03-01</a></li>
<li><a href="link5.php">Event5 2005-04-01</a></li>
<li><a href="link6.php">Event6 2005-05-01</a></li>
<li><a href="link7.php">Event7 2005-06-01</a></li>
<li><a href="link8.php">Event8 2005-07-01</a></li>
</ul>

I want to show all events two weeks ahead but hide the
events in the past.

That's not possible with CSS, is it?
Can anyone help with an easy solution?

I hardly know any PHP and would prefer a solution
without a database. (The event list hardly ever changes.)

Thanks
chlori
 
M

Mitja

I will have a list of events, like this:

<ul>
<li><a href="link1.php">Event1 2004-12-01</a></li>
<li><a href="link2.php">Event2 2005-01-01</a></li>
<li><a href="link3.php">Event3 2005-02-01</a></li>
</ul>

I want to show all events two weeks ahead but hide the events in the
past.

That's not possible with CSS, is it?
Nope. CSS has about as much to do with it as my uncle's panties.
I hardly know any PHP and would prefer a solution without a database.
(The event list hardly ever changes.)
Even so, PHP is the best way to go (or Python, or Perl, ....).
Alternatively, you could do it with JavaScript, but it would only work for
people with JS enabled (other would see all the events, if you coded it
correctly), but it would be harder to do.
You don't need a database, just a plain-text file with info like
2004-12-01|This is event 1
2005-01-01|This is event 2

Then you do something like
foreach (LINE_OF_FILE as $line) {
$date=$line.explode('|')[0];
$event=$line.explode('|')[0];
print("<li><b>$event</b> -- $date</li>");
}
The above won't work, I've never used PHP and have no idea on how to work
with files, but a simple tutorial should help you out.
 
C

chlori

Mitja schrieb am 24.11.2004 17:36:
Alternatively, you could do it with JavaScript, but it would only work for
people with JS enabled (other would see all the events, if you coded it
correctly), but it would be harder to do.

I want ist to be usable on handhelds and with the
effect I'm looking for so that handhelds don't display
the whole list. And AFAIK most handhelds don't really
support javascript...
You don't need a database, just a plain-text file with info like
2004-12-01|This is event 1
2005-01-01|This is event 2

Then you do something like
foreach (LINE_OF_FILE as $line) {
$date=$line.explode('|')[0];
$event=$line.explode('|')[0];
print("<li><b>$event</b> -- $date</li>");
}

I'll try to find out what this exactly does... thanks!
The above won't work, I've never used PHP and have no idea on how to work
with files, but a simple tutorial should help you out.

Does anyone know of a good tutorial for things like
this? I would like to find this solution (if possible)
before I learn PHP properly (because that will be next
summer) but I found it difficult to find help in
tutorials/PHP-sites because I'm not exactly sure what
to look for...

chlori
 
M

Mitja

Does anyone know of a good tutorial for things like this? I would like
to find this solution (if possible) before I learn PHP properly (because
that will be next summer) but I found it difficult to find help in
tutorials/PHP-sites because I'm not exactly sure what to look for...

Just about anything will do. The first hit of
http://www.google.com/search?q=php+tutorial+text+files
seems nice to me.
But before that, you should probably learn the basics of php, because
you'll never find the exact code you're looking for, you'll have to learn
and adapt it to suit you needs. Google for something like php
non-programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top