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]
  • #1 / Sep 21, 2007 3:43pm

    ignite

    149 posts

    I’m sure I’m doing something wrong. Perhaps the way I implemented the calender was a mistake but either way I need to fix.

    Here’s the problem:
    In developing the calendar I used the entry_date and expiration_date to hold the dates of the event. So the following…

    {entry_date format='%n/%j'}-{expiration_date format='%n/%j'}

    ...would show something like “9/12-9/24”.

    That works fine except that when I limited the dates to be show using the start_on parameter for the entries tag. So as soon as current_time is beyond the entry_date then the entry no longer shows. So to correct that I removed the start_on parameter from the entries tag and used a conditional to limit what shows.

    {if {entry_date} > {current_time} OR {expiration_date} > {current_time}}

    That works well too except now the date_heading tag pair doesn’t show in the first instance since the first entry is before the current_time. Is there a way for me to get around this? I hope I made sense.

    PS: Should note that if the event didn’t span multiple days then expiration_date was left empty.

  • #2 / Sep 21, 2007 3:48pm

    Lisa Wess

    20502 posts

    Lost me, I think it is the pretty blue you used, I just love that color…

    Ok.  First - we need the entire snippet of code that isn’t working, please.  And a link to the site would help, as well as the version and build.

    Thank you!

  • #3 / Sep 21, 2007 4:07pm

    ignite

    149 posts

    I was losing it without the blue. 😉

    Here’s the code:

    <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"}  <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 />
    {/exp:weblog:entries}</p>
    
    <p><br />
    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_expired="yes" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"}<br />
        <br />
    {if {entry_date} > {current_time} OR {expiration_date} > {current_time}}<br />
        {if sticky == 'y'}<br />
            {date_heading display="daily"}<br />
            <div class="sticky"><br />
                </p><h4>Featured Dates</h4>
    <p>        {/date_heading}<br />
                <span>{entry_date format="%m/%d/%Y"}</span> <a href="http://{path=community/event/{url_title}}">{title}</a><br />
            {date_footer display="daily"}</div>{/date_footer}<br />
        {/if}<br />
        <br />
        {if sticky == 'n'}<br />
        {date_heading display="monthly"}<dl id="{entry_date format="%F_%Y"}" class="month_view"><dt>{entry_date format="%F %Y"}</dt>{/date_heading}<br />
        <dd><br />
            <span>{entry_date format="%n/%j"}{if expiration_date != 0} – {expiration_date format="%n/%j"}{/if} </span><br />
            <a href="http://{path=community/event/{url_title}}">{title}</a><br />
        </dd><br />
        {date_footer display="monthly"}</dl>{/date_footer}<br />
        {/if}<br />
    {/if}

    And here’s the page.

  • #4 / Sep 21, 2007 4:10pm

    Lisa Wess

    20502 posts

    Ok, why are your variables in {} inside the conditionals? They should not be.

    {if entry_date > current_time OR expiration_date > current_time}

    hrm, but you may need to use some paranthesis to keep those things together. 

    But lets make sure that everything is working without the cnoditionals -a nd why do you have two separate weblog entries tags for this?

    Lets isolate this, try:

    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"}  
       
        {date_heading display="monthly"}<a href="#{entry_date" class="jump">{entry_date format="%F %Y"}</a>{/date_heading}                            
       
    {/exp:weblog:entries}

    and see if it works.

  • #5 / Sep 21, 2007 4:11pm

    ignite

    149 posts

    Side-note: It would be nice if the code tag in the forum also produced line numbers so you could comment based on a certain line number. Call it a feature request for the forums.

  • #6 / Sep 21, 2007 4:12pm

    ignite

    149 posts

    Lisa, you are incredibly fast! I will remove the conditionals limiting the results.

  • #7 / Sep 21, 2007 4:13pm

    Lisa Wess

    20502 posts

    Go ahead and post it as a feature request, and quit derailing your own thread, or I shall turn it into a pillow fight. You have been warned! 😉

  • #8 / Sep 21, 2007 4:15pm

    ignite

    149 posts

    Go ahead and post it as a feature request, and quit derailing your own thread, or I shall turn it into a pillow fight. You have been warned! 😉

    😉

    The changes are live… it shows the entire list of events.

  • #9 / Sep 21, 2007 4:18pm

    Lisa Wess

    20502 posts

    Ok, but the date headings work, correct? So we can conclude the problem is with the conditional?

    In that case, I’m going to move this up to the how-to forum A few things to note:

    {if entry_date > current_time OR expiration_date > current_time}

    You don’t want those inner variables in curly brackets, I’ve pasted the correct way.

    You may also need parenthesis to keep the statements together.  Hopefully someone better with logic can help you get the right syntax.  I’d highly recommend echoing out those variables so you can see *exactly* what is being compared, you might find it to be enlightening. =)

  • #10 / Sep 21, 2007 4:24pm

    ignite

    149 posts

    I tried it like your example above and it doesn’t work. Using the curley brackets was the only way I could get it to work. It just show all of the entries.

  • #11 / Sep 21, 2007 4:27pm

    ignite

    149 posts

    Parenthesis didn’t help either.

  • #12 / Sep 21, 2007 4:31pm

    ignite

    149 posts

    Lisa, somethings not working right it seems. It’s either date_heading or the if statement. It’s not how I typed it since your example doesn’t work either.

  • #13 / Sep 21, 2007 4:54pm

    Lisa Wess

    20502 posts

    Hi ignite - I don’t think you need to post every 4 minutes.  I answered your PM as well.  Please - we do ask for at least some patience here, we’re not robots, we’re human beings, and occasionally it takes more than a minute for an answer.

    This is the appropriate forum for this as you are asking how to compare these dates and use a date heading; it’s customization help that goes beyond what we can offer as technical support. Now, lets move on to the nitty gritty.

    We know the date_heading works, we tested it, yes?

    So, now we need to troubleshoot the conditional.  To do that, we reduce and isolate. I gave you some tips on that before, but lets go ahead now.  Place this on a totally blank template.

    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"}  
     {entry_date}
    
    {current_time}
    
    {expiration_date}
    
    {current_time}
    
    {if entry_date > current_time}
    the entry date is greater than the current time
    
    {/if}
    {if expiration_date > current_time}
    the expiration date is greater than the current time
    
    {/if}
    {/exp:weblog:entries}

    Link to that template, and lets see what EE is thinking about your variables, and about your conditionals.

  • #14 / Sep 21, 2007 5:02pm

    ignite

    149 posts

    My apologies… Thanks for YOUR patience. 😉

    Here is that template.

  • #15 / Sep 21, 2007 5:08pm

    Lisa Wess

    20502 posts

    What the heck is 0.  Ok, can you modify the template for me?  I can’t follow it without some more information, I should have thought of that:

    {exp:weblog:entries weblog="events" category="not 33" dynamic="off" show_future_entries="yes" display_by="month" limit="18" sort="asc" orderby="date"}  
    <b>entry_date</b>: {entry_date}
    
    <b>current_time</b>: {current_time}
    
    <b>expiration_date</b>: {expiration_date}
    
    <hr >
    {if entry_date > current_time}
    <h2>conditional 1: is the entry date greater than the current time?</h2>
    <p><b>yes!</b> the entry date is greater than the current time</p>
    
    <p>{/if}<br />
    {if expiration_date > current_time}</p><h2>conditional  2: is the expiration date greater than the current time?</h2>
    <p><b>yes!</b>the expiration date is greater than the current time</p>
    
    <p>{/if}<br />
    ***<br />
    {/exp:weblog:entries}

    that’ll help my reading comprehension, thanks =)

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

ExpressionEngine News!

#eecms, #events, #releases