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.

Display only this month's events

June 24, 2007 4:07pm

Subscribe [3]
  • #1 / Jun 24, 2007 4:07pm

    Deelicious

    86 posts

    I’ve searched through the forum and tried to solve this issue, but I’ve not had any luck.

    I’m trying to simply display a list of the current month’s events on a page. When posting events, I give each event an entry date and expiration date.

    If I use the following code, the page displays the first month with an event of the entire year only:

    {exp:weblog:entries weblog="calendar" show_future_entries="yes" show_expired="yes" sort="asc"  dynamic_parameters="weblog" display_by="month" limit="1" orderby="date"}  
                {date_heading display="monthly"}
                <h2>{entry_date format="%F"} Events</h2>
    <p>            {/date_heading}             </p>
    
    <p>            </p><h3><a href="http://{title_permalink=calendar/details">{title}</a></h3>
    <p>            {entry_date format='%D - %F %j,%Y'}<br />
                <div class="dotLine"></div><br />
            {/exp:weblog:entries}

    How can I alter this to display only the current month? Thanks for any help.

  • #2 / Jun 24, 2007 4:26pm

    hothousegraphix

    851 posts

    Hey, how r you?

    I would guess, currently, when you load the page with this tag you’re actually getting information for the first month you have information for?

    I just went thru this exact process. Try appending your URL with /2007/06, June being the current month. If this works for you, you just need to provide EE a little direction.

    In your template that calls the template with this tag you will add this:

    <!-- lets tell EE what the current month is -->
    <?php
    global $LOC;
    $current_time = $LOC->decode_date('%Y/%m/', $LOC->now);
    ?> 
    
    <!-- here's your menu that will call the events page -->
    
    <div id="Main_nav">
    <ul>
    <li><a href="/pathToMenuItme1/">menu item 1</a></li>
    <li><a href="/pathToMenuItme2/">menu item 2</a></li>
    <li><a href="/pathToEventsPage/&lt?php">Events</a></li>
    //notice the appended URL with the current time
    </div>

    I’m by no means a expert…but I just had this exact same issue…If I can help out, I’m glad to.

  • #3 / Jun 24, 2007 6:10pm

    Deelicious

    86 posts

    Thanks for the quick response! This was exactly what I was looking for. 😊

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

ExpressionEngine News!

#eecms, #events, #releases