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.

Archive Week Links Tag?

July 18, 2012 11:28am

Subscribe [3]
  • #1 / Jul 18, 2012 11:28am

    jefinho

    26 posts

    Hello,

    I’m trying to create a week based archive in ExpressionEngine. For as far I can see there isn’t a native solution available, such as the Archive Month Links Tag:
    http://ellislab.com/expressionengine/user-guide/modules/channel/archive_month_links.html

    Does anyone know a good way to achieve this?
    Thanks in advance!
    Jef

  • #2 / Jul 18, 2012 6:36pm

    Kyle Cotter

    730 posts

    Hey Jef,

    Michael Boyink over at Train-ee wrote an article highlighting what you’re trying to do.

    Let me know if you think his solution will work for you.

    Thanks.

  • #3 / Jul 19, 2012 4:57am

    jefinho

    26 posts

    Hi Kyle,
    Thanks for the link! The solution almost works.
    Somehow entries posted in week 29 are filtered out in week 28.
    Do you have any idea why this happens?
    Thanks!
    Jef

  • #4 / Jul 19, 2012 5:24pm

    Shane Eckert

    7174 posts

    Hey Jefinho,

    Would you mind showing me what you have for your template code?

    Are your time settings correct? When you post an entry, do it show the correct date and time?

    Thank you,

  • #5 / Jul 20, 2012 2:24am

    jefinho

    26 posts

    Thanks for your responds.
    Entry’s are posted at the correct day, but an incorrect time (2 hours earlier). The setting for my server time zone under ‘Localization settings’ is ‘(UTC) Greenwich Time, Western European Time’. Since this website is used mostly in Western Europe, I thought that was alight. Changing it to ‘UTC +2:00” doesn’t fix the time-problem. All entries are registered 2 hours earlier than they were really sent.

    So here’s the code that generates the week-menu:

    exp:channel:entries dynamic="no" channel="nieuws" orderby="date" sort="desc" limit="53" disable="member_data|pagination|categories|custom_fields" show_future_entries="yes"}
       {date_heading display="weekly"} 
       <option value="{path='nieuws'}/{segment_2}/{week_date format="%YW%W"}">week {week_date format="%W - %Y"}</option>
       {/date_heading}
       {/exp:channel:entries}

    And here the list of entries for the selected week:

    <?php
       if ($this->EE->uri->segment(3) === FALSE)
       {
        // current date
            $entryDate = date("Y-m-d");
       }
       else
       {
           $entryDate = $this->EE->uri->segment(3);
       } 
       ?> 
       {exp:channel:entries channel="nieuws" dynamic="no" disable="member_data|trackbacks" status="open" show_future_entries="yes" start_on="<?php echo date('Y-m-d', strtotime("$entryDate")) . " 00:00"; ?>" stop_before="<?php echo date('Y-m-d', strtotime("$entryDate"."7")) . " 24:00"; ?>"}
       {if no_results}
       <li>no results message here </li>
       {/if}
       <li>news item here</li>
       {/exp:channel:entries}

    I don’t know if this is the best way to do this. However the ‘start_on’ and ‘stop_before’ parameters DO work. They do filter out the correct entry’s with the corresponding week.
    I hope you can help me out.
    Thanks!
    Jef

  • #6 / Jul 23, 2012 11:49am

    jefinho

    26 posts

    Anyone…?

  • #7 / Jul 23, 2012 3:33pm

    Dan Decker

    7338 posts

    Hi Jefinho,

    Sorry for your delays, we don’t have staff over the weekends!

    Localization in ExpressionEngine can be tricky.

    In Admin->Localization the timezone needs to be accurate for the server that is running EE. Them, each member can be allowed to set their own timezone, or forced to honor EE’s setting.

    Regarding your solution above, is it doing what you need? Are you getting the results you want?

    Cheers,

  • #8 / Jul 24, 2012 2:29am

    jefinho

    26 posts

    Hi Dan,

    Thanks for the reply. I understand you don’t have staff over the weekends.
    Unfortunately I don’t get the results I want.
    The weird thing is, using Boyink’s idea, I get a different result than using php + some general EE tags.

    However the ‘start_on’ and ‘stop_before’ parameters are giving me the correct result. All entries within a specific week are filtered out.
    However, by the following code (Boyink) all entry’s are filtered out one week earlier:

    exp:channel:entries dynamic="no" channel="nieuws" orderby="date" sort="desc" limit="53" disable="member_data|pagination|categories|custom_fields" show_future_entries="yes"}
       {date_heading display="weekly"} 
       <option value="{path='nieuws'}/{segment_2}/{week_date format="%YW%W"}">week {week_date format="%W - %Y"}</option>
       {/date_heading}
       {/exp:channel:entries}

    I’m not sure if this has to do with time settings, since all entries have the correct publish day.
    I hope someone can help me out.

    Thanks,
    Jef

     

  • #9 / Jul 25, 2012 10:38am

    Dan Decker

    7338 posts

    Hey Jef,

    You might need to set the start_day= and display_by= parameters:

    {exp:channel:entries dynamic="no" channel="nieuws" orderby="date" sort="desc" limit="53" disable="member_data|pagination|categories|custom_fields" display_by="week" start_day="Monday" show_future_entries="yes"}
       {date_heading display="weekly"} 
       <option value="{path='nieuws'}/{segment_2}/{week_date format="%YW%W"}">week {week_date format="%W - %Y"}</option>
       {/date_heading}
       {/exp:channel:entries}

    Does that help?

    Cheers,

  • #10 / Jul 25, 2012 11:08am

    jefinho

    26 posts

    Hi Dan,

    That does help!
    Thanks a lot!

  • #11 / Jul 25, 2012 4:26pm

    Kyle Cotter

    730 posts

    Hey Jef,

    Glad to see Dan was able to help you out.

    Do you have any more questions?

    Thanks.

  • #12 / Jul 26, 2012 1:59am

    jefinho

    26 posts

    Hi Kyle,
    No more questions.
    Thanks

  • #13 / Jul 26, 2012 3:08am

    Kyle Cotter

    730 posts

    Great! If you have any more issues, feel free to start a new thread, Jef.

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases