ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Time range

October 03, 2007 9:14am

Subscribe [3]
  • #1 / Oct 03, 2007 9:14am

    gezzle

    1 posts

    Hi,

    I’am trying to show posts everyday but within a time range. For example, everyday at 1:00 pm, I want to have a particular post displayed and the day afterwards and it goes on. Anybody has a clue how we can test the time range, unfortunately we got the date field which adds the date. I just want the time/ Thanks

    Asvin

  • #2 / Oct 03, 2007 6:57pm

    e-man

    1816 posts

    You’re going to have to use some php to do this. This function:

    <?php
    $time= localtime(time(), true);
    ?>

    will output an array such as this:
    Array
    (
      [tm_sec] => 24
      [tm_min] => 3
      [tm_hour] => 19
      [tm_mday] => 3
      [tm_mon] => 3
      [tm_year] => 105
      [tm_wday] => 0
      [tm_yday] => 92
      [tm_isdst] => 1
    )
    From there in you could use conditionals to let post appear. But the whole idea strikes me as kind of weird in the first place.

  • #3 / Oct 04, 2007 4:16am

    gezzle

    1 posts

    thanks eman, in fact it’s for a radio website and on it’s front page, they want to display the program currently on air. Anyway I found another way to do it by using the stop_before parameter, and ‘fixing’ the date of the entry, ie. all entries in the weblog have the same date, for eg. 2007-01-01 but only the time differs, and in the template I just have to put :
    stop_before=“2007-01-01 {current_time format="%g:%i %A"}”

    thanks man

  • #4 / Oct 04, 2007 7:22am

    e-man

    1816 posts

    I see now why you’d need that 😊  Pretty slick solution also!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases