Dynamic event list (simple)

Discussion in 'HTML' started by chlori, Nov 24, 2004.

  1. chlori

    chlori Guest

    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
     
    chlori, Nov 24, 2004
    #1
    1. Advertising

  2. chlori

    Mitja Guest

    On Wed, 24 Nov 2004 17:23:20 +0100, chlori <chlori@.invalid> wrote:

    > 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.

    --
    Mitja
     
    Mitja, Nov 24, 2004
    #2
    1. Advertising

  3. chlori

    chlori Guest

    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
     
    chlori, Nov 25, 2004
    #3
  4. chlori

    Mitja Guest

    On Thu, 25 Nov 2004 08:28:29 +0100, chlori <chlori@.invalid> wrote:

    > 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.

    --
    Mitja
     
    Mitja, Nov 25, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gerry
    Replies:
    0
    Views:
    554
    gerry
    Apr 24, 2004
  2. arthernan
    Replies:
    0
    Views:
    1,492
    arthernan
    Mar 10, 2006
  3. roopa
    Replies:
    6
    Views:
    763
    Jerry Coffin
    Aug 27, 2004
  4. dackz
    Replies:
    0
    Views:
    497
    dackz
    Feb 6, 2007
  5. Matt Kruse
    Replies:
    1
    Views:
    203
    Calan
    Apr 6, 2004
Loading...

Share This Page