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.

Problem showing future entries using {current_time}

March 03, 2008 9:25pm

Subscribe [2]
  • #1 / Mar 03, 2008 9:25pm

    Motomasa

    17 posts

    I’m working on my second EE site, and it is one for a radio show I do. The basic idea behind the site is to promote upcoming broadcasts, as well as playlists and guest information for past shows. This has been quite challenging in general because I am not a back-end guy, so I am not very fluent with HTML, CSS, JS, etc.

    The basic layout for the front page can be found here. I haven’t dropped in the navigation at the top, but you will see that there are 3 boxes below the nav area which have green outlines.

    The leftmost box will feature the “Next Show” information, and is an embedded template with the following code in the body:

    <div id=“top_box”>
      {exp:weblog:entries weblog="ShowBlog" limit="1" sort="asc" show_future_entries="yes" start_on="{current_time format="%Y-%m-%d"} 00:01”}
      <div class=“topic_head”>Next broadcast: {Show_Date format="%M %d %Y"}

      {Guest_1}</div>
      <div class=“body_type”>{current_time format="%Y-%m-%d"}{summary}... (more)</div>
      {/exp:weblog:entries}
    </div>

    And as you can see, on the main page, it pulls up the correct information. In the main body below, there should be multiple listings for future shows, starting the week after the “Next Show” box (I have some entries with made up names/dates). To do this, I have used the suggested php as follows:

    <?php
    global $LOC;
    $current_time = $LOC->decode_date(’%Y-%m-%d %g:%i %A’, $LOC->now + 604800);
    ?>

    <td width=“66%”>

    {exp:weblog:entries weblog="ShowBlog" limit="4" sort="asc" show_future_entries="yes" start_on="<?php echo $current_time; ?>"}
    {Show_Date format="%M %d, %Y"}

    <class=“topic_head”>{Guest_1}</br>
    <font size=”-1”>({Guest_1_Affiliation})</font size>
    {summary}... (more)
    <div id=“sm_spacer”> </div>
    {/exp:weblog:entries}
    </td>

    Now the problem comes when you link to one of the shows shown in the main body. When I click on any of those links, it takes me to the page with the full bio information, but suddenly, the “Next Show” box lists the wrong show (i.e. usually the show whose link was just clicked). Additionally, if one accesses a past show (for example, change the date at the end of the URL to, say, feb_14_2008) and now that “Next Show” box becomes empty.

    This makes no sense to me because {current_time} should always read the actual time, and perform the called function based on that should it not? Am I missing something?

    —————————- Added Note

    If you look in the “Next Show” box, you will also see a date before the summary text, which shows the {current_time} is reading correctly (i.e. it shows the current date). I put that in to make sure the date was being read correctly - but it doesn’t stop the blog entry from being the wrong one.

  • #2 / Mar 05, 2008 12:32pm

    e-man

    1816 posts

    I am not a back-end guy, so I am not very fluent with HTML, CSS, JS, etc.

    Confusing this, as someone who is not “a back-end guy” would have to be good with HTML, CSS and JS, all of which are considered “front-end” languages. 😊

    Back to your problem, I believe that adding dynamic=“off” to

    {exp:weblog:entries weblog="ShowBlog" limit="4" sort="asc" show_future_entries="yes" start_on="<?php echo $current_time; ?>"}

    will sort your problem.
    So:

    {exp:weblog:entries weblog="ShowBlog" limit="4" dynamic="off" sort="asc" show_future_entries="yes" start_on="<?php echo $current_time; ?>"}
  • #3 / Mar 05, 2008 10:54pm

    Motomasa

    17 posts

    I am not a back-end guy, so I am not very fluent with HTML, CSS, JS, etc.

    Confusing this, as someone who is not “a back-end guy” would have to be good with HTML, CSS and JS, all of which are considered “front-end” languages. 😊

    Ah, well I come from a 15-year DTP/pre-press background, so any kind of coding is considered “back-end” to me. I only ever get the call to create a good graphic, and provide sliced up jpegs.

    I’ll give this a try for sure! Thanks for the help.

  • #4 / Mar 05, 2008 11:39pm

    Motomasa

    17 posts

    Adding the [dyanmic=“off”] seems to have done the trick. Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases