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.

Channel Entry show_current_week="yes"

March 14, 2012 11:07am

Subscribe [2]
  • #1 / Mar 14, 2012 11:07am

    Phil Ecker

    78 posts

    I’m having an issue with show_current_week=“yes”, I have it set and have the start_day set to Monday… but I have a calendar event on a Sunday but it isn’t displaying in my results.

    <div class="calendar-sort">
     {exp:channel:entries channel="calendar_entry" sort="asc" orderby="entry_date" display_by="week" start_day="Monday" limit="1"}
     
     <div class="event-entry">
         <h3>{title} - {entry_date format='%F, %d, %Y'}</h3>
    <p> <br />
         <div class="event-time"><br />
             {if start_time != "0"}Start Time: {start_time format="%g:%i%a"}{/if} {if end_time != "0"} - End Time: {end_time format="%g:%i%a"}</p>
    
    <p>         {/if}<br />
         </div>{event_details}<br />
     <br />
         <div class="required"><br />
             <strong>Required Attendees:</strong> {if required_attendees != ""}{required_attendees backspace = "2"}{cm_member_firstname} {cm_member_lastname}, {/required_attendees}{if:else}N/A{/if}<br />
         </div><br />
     <br />
         <div class="other"><br />
             <strong>Other:</strong> {if other != ""}{other}{if:else}N/A{/if}<br />
         </div><br />
     </div>{if no_results}<br />
     <br /></p><h3>There are no Entries.</h3><p>{/if} {/exp:channel:entries}<br />
     </div>

     

  • #2 / Mar 15, 2012 12:49pm

    Shane Eckert

    7174 posts

    Hello Phil,

    I am sorry to hear you are running into this problem.

    Which Sunday is not being displayed? The Sunday before the Monday start date, or the Sunday following the Monday start date? I pasted your code into my sandbox and it seems to be working as expected.

    Please let me know.

    Cheers,

  • #3 / Mar 15, 2012 1:20pm

    Phil Ecker

    78 posts

    Hey Shane,

    It’s not showing the Sunday following the Monday start date (this coming Sunday). I have an channel entry with a date of the 14th which displays fine, but I have a an entry with a date of the 18th that does not display… Logically I would think that the 18th this coming Sunday would be part of this week with it being set to start on Monday. Any thoughts would be greatly appreciated. Hoping an Eckert can help an Ecker 😊 Thanks.

    -Phil

  • #4 / Mar 15, 2012 3:29pm

    Phil Ecker

    78 posts

    Shane,

    I have found that if I have the code as below works as I expected with showing the entries I want. But my issue is I don’t want to have to update this every week… thoughts on how I can make this dynamic? I tried {current_time} but then I lose my entries that have happened before the current time. Thanks again.

    {exp:channel:entries channel="calendar_entry" sort="asc" orderby="entry_date" display_by="week" show_future_entries="yes" show_current_week="yes" start_on="{2012-03-12 01:00'}" show_expired="yes" start_day="Monday" limit="1"}
    
    <div class="event-entry">
        <h3>{title} - {entry_date format='%F, %d, %Y'}</h3>
    
    <p>    <div class="event-time"><br />
            {if start_time != "0"}Start Time: {start_time format="%g:%i%a"}{/if} {if end_time != "0"} - End Time: {end_time format="%g:%i%a"}</p>
    
    <p>        {/if}<br />
        </div>{event_details}</p>
    
    <p>    <div class="required"><br />
            <strong>Required Attendees:</strong> {if required_attendees != ""}{required_attendees backspace = "2"}{cm_member_firstname} {cm_member_lastname}, {/required_attendees}{if:else}N/A{/if}<br />
        </div></p>
    
    <p>    <div class="other"><br />
            <strong>Other:</strong> {if other != ""}{other}{if:else}N/A{/if}<br />
        </div><br />
    </div>{if no_results}</p>
    
    <h3>There are no Entries.</h3><p>{/if}<br />
    {/exp:channel:entries}

  • #5 / Mar 16, 2012 4:33pm

    Dan Decker

    7338 posts

    Hey Phil,

    I think the issue is related to this note in the User Guide regarding display_by=

    This parameter uses UTC/GMT time and is not localized to the server or logged in user.

    So if Sunday’s entry date was offset to GMT to *not* be Sunday, it wouldn’t show up. If you adjust the entry date by your timezone’s GMT offset, does it display as expected?

    Cheers,

  • #6 / Mar 16, 2012 5:14pm

    Phil Ecker

    78 posts

    Thanks Dan,

    That makes sense, but don’t know if I will try that as I found the following solution.

    {exp:channel:entries channel="calendar_entry" sort="asc" orderby="entry_date" display_by="week" show_future_entries="yes" show_current_week="yes" start_on="<?php echo date('Y-m-d', strtotime('last monday', strtotime('next monday'))); ?>" show_expired="yes" start_day="Monday" limit="1" dynamic="no"}
  • #7 / Mar 18, 2012 2:28pm

    Dan Decker

    7338 posts

    Hey Phil,

    Sweet solution! Thanks for sharing.

    Is there anything else we can assist you with?

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases