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.

date_heading not showing...

September 21, 2007 3:43pm

Subscribe [1]
  • #31 / Sep 26, 2007 6:15pm

    Lisa Wess

    20502 posts

    Did you try it with just the word TEST inside the conditionals? Did that show?

  • #32 / Sep 27, 2007 11:22am

    ignite

    149 posts

    Lisa, I added a separate conditional to the code which looks like this:

    <h4>Jump to Month</h4>
    
    <p>{exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"}  <!-- start_on="{current_time format='%Y-%m-%d %g:%i %A'}" show_expired="yes" --><br />
        {if entry_date > {current_time} OR expiration_date > {current_time}}<br />
        {date_heading display="monthly"}<a href="#{entry_date" class="jump">{entry_date format="%F %Y"}</a>{/date_heading}                            <br />
        {/if}<br />
        <br />
        {if entry_date > {current_time} OR expiration_date > {current_time}}<br />
        test                             <br />
        {/if}<br />
    {/exp:weblog:entries}</p>
    
    <p><br />
    ...

    I took a screenshot of the result (attached). The example shown uses both conditionals but I tried it with each one separately and it just showed fewer results. The conditional seems to be working. The date heading doesn’t get run the first time through but you can see that the word test shows 5 times before you get to October which corresponds to the 5 september events being shown.

  • #33 / Sep 28, 2007 2:04pm

    ignite

    149 posts

    Lisa,

    So based on the above do you think it’s a problem with the date_heading tag pair? If so is there a work around?

    Also, should the current_time have brackets around it when used in a conditional or is that a bug? It doesn’t seem to fall in line with the way other variables are evaluated.

  • #34 / Sep 28, 2007 2:07pm

    Lisa Wess

    20502 posts

    Yes, it should have brackets in this case.  Can you try a quick test?

    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"} 
    
        {if entry_date > {current_time} OR expiration_date > {current_time}}
        The conditional this is inside of came out true                  
        {/if}
        {/exp:weblog:entries}

    just that alone, on an otherwise blank template, with not a thing other than this code in it.

  • #35 / Sep 28, 2007 2:14pm

    ignite

    149 posts

    Here is a template with just that code in it.

  • #36 / Sep 28, 2007 2:19pm

    Lisa Wess

    20502 posts

    Ok, now try this:

    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"} 
    
        {if entry_date > {current_time} OR expiration_date > {current_time}}
    
                  {date_heading display="monthly"}This is the month{/date_heading}
    
    
        {/if}
    
        {/exp:weblog:entries}
  • #37 / Sep 28, 2007 4:02pm

    ignite

    149 posts

    Ok, that test page is updated.

    Edit: Sorry took so long to respond… had to go to a career day thing at a local middle school.

  • #38 / Sep 28, 2007 4:05pm

    Lisa Wess

    20502 posts

    Ok, let’s see with some actual data to see if we’re getting correct results?

    current_time</b>: {current_time format="%D, %F %d, %Y - %g:%i:%s"}
    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"} 
    
        {if entry_date > {current_time} OR expiration_date > {current_time}}
    
                  {date_heading display="monthly"}{entry_date format="%F_%Y"}{/date_heading}
    
    
        {/if}
    {title} 
    
    <b>entry_date</b>: {entry_date format="%D, %F %d, %Y - %g:%i:%s"}
    
    <b>expiration_date</b>: {expiration_date format="%D, %F %d, %Y - %g:%i:%s"}
    
    <hr >
        {/exp:weblog:entries}

    and let me know when updated.

  • #39 / Sep 28, 2007 4:14pm

    ignite

    149 posts

    Test page updated…

  • #40 / Sep 28, 2007 4:22pm

    Lisa Wess

    20502 posts

    Ok, so just to confirm - the problem here is that it all works, except that the first date_heading does not display? Is that accurate?

  • #41 / Sep 28, 2007 4:28pm

    ignite

    149 posts

    That’s correct… the if statement seems to work fine. It’s that first date heading that doesn’t get run, the rest work after that.

  • #42 / Sep 28, 2007 4:35pm

    Lisa Wess

    20502 posts

    Can you just try it like this?

    current_time</b>: {current_time format="%D, %F %d, %Y - %g:%i:%s"}
    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"} 
    
        {if entry_date > {current_time} OR expiration_date > {current_time}}
    
                  {date_heading display="monthly"}{entry_date format="%F_%Y"}{/date_heading}
    
    
        
    {title} 
    
    <b>entry_date</b>: {entry_date format="%D, %F %d, %Y - %g:%i:%s"}
    
    <b>expiration_date</b>: {expiration_date format="%D, %F %d, %Y - %g:%i:%s"}
    
    {/if}
    <hr >
        {/exp:weblog:entries}

    Basically, we’re encapsulating the whole thing in the conditional, to see if it’s all not running - that would still indicate an issue with the conditional.  This is a bit confusing, though, so once I see those results I’ll probably get someone fresh to look at this.

  • #43 / Sep 28, 2007 4:38pm

    ignite

    149 posts

  • #44 / Sep 28, 2007 4:42pm

    Lisa Wess

    20502 posts

    Well, form that it certainly looks as though the first month simply does not meet your conditional requirements, since it’s not showing any of that information. I believe, in this case, it is comparing it to the most recent entry for your purposes.  So does the newest entry in that list meet your conditional’s requirements?

  • #45 / Sep 28, 2007 5:00pm

    ignite

    149 posts

    Well, form that it certainly looks as though the first month simply does not meet your conditional requirements, since it’s not showing any of that information.

    Are you refering to the condition of the date_heading tag pair? The September entries are being returned as expected so the if statement IS working properly. What conditions must be met for the date_heading tag pair to be run?

    I believe, in this case, it is comparing it to the most recent entry for your purposes.  So does the newest entry in that list meet your conditional’s requirements?

    I guess I’m not clear on what you mean by newest. It seems to me to that first entry (maybe that’s what you meant by newest?) that meets the condition for the if statement but for some reason doesn’t trigger the date_heading tag pair. Why that is isn’t clear to me. Is it because the “entry_date” is older than the “current_time” since the the “expiration_date” is the portion that meets the if statement’s criteria?

    I am, however, getting back the information I was expecting/wanted by using that if statement.

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

ExpressionEngine News!

#eecms, #events, #releases