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 Month Links Not Working

January 07, 2011 8:30pm

Subscribe [5]
  • #1 / Jan 07, 2011 8:30pm

    mgrothman

    10 posts

    I am a total newbie with Expression Engine.

    The Archive Month Links on our site are not functioning correctly as they just keep returning the same results?

    The blog page: http://worldsavvy.org/blog/

    If you click on any of the months under blog dates, the same results are displayed???

    Here is the code directly from the template:

    {exp:channel:month_links channel="{segment_1}"}
    <li><a href="http://{site_url}{segment_1}/?month={month_num}&year={year}">{month_long} {year}</a></li>
    {/exp:channel:month_links}

    The channel being referenced is “blog”.

    Moved to EE2 Support by Moderator

  • #2 / Jan 09, 2011 5:37pm

    Greg Salt

    3988 posts

    Hi mgrothman,

    Welcome to the forums!

    Please have a look at the path parameter in the documentation for the correct way to reference your month archives.

    Cheers

    Greg

  • #3 / Jan 11, 2011 5:52pm

    mgrothman

    10 posts

    The Categories list (“Blog Categories” on that same page) is set up the same way. It is returning the results correctly?

    <div id="blog_categories">
    <h3>{segment_1} Categories</h3>
    <p>{exp:channel:categories channel="{segment_1}"}<br />
    <a href="http://{site_url}{segment_1}/?category={category_id}">{category_name}</a><br />
    {/exp:channel:categories}<br />
    </div>

    I am not sure why they did not set it up with the path variable linking to a template, but when I set it up to point to a template the results are still only parsing the latest entries and not actually the month that is being searched?

    Also the {year} variable is returning 2010 for January?

  • #4 / Jan 12, 2011 8:12am

    Sue Crocker

    26054 posts

    Hi, mgrothman. Are you using EE2.x? You posted in a 1.x support forum, but you’re using the verbage for EE2.x.

    Which build/version are you using? You can find that out at the bottom of any control panel page, in the footer.

  • #5 / Jan 12, 2011 12:10pm

    mgrothman

    10 posts

    Sorry, it is in fact version 2.1.0

  • #6 / Jan 13, 2011 1:44am

    John Henry Donovan

    12339 posts

    mgrothman,

    I am not really understanding how your menu’s are or why they are set up like they are.
    The URLs are non standard to EE. I am referencing Blog Categories and your archive links of course

    Take a blog category for example. The URL on your site is http://worldsavvy.org/blog/?category=8

    When in fact it should be something like http://worldsavvy.org/blog/category/C8

    Your month URLs should look similar to this

    http://worldsavvy.org/blog/archives/2011/01/

    Are you taking over the developer of this site from another developer?

    Regardless of how it was set-up I can tell you your problem is a simple one. Remove the semicolon after &year; and you should be good

    {exp:channel:month_links channel="{segment_1}"}
    <li><a href="http://{site_url}{segment_1}/?month={month_num}&year={year}">{month_long} {year}</a></li>
    {/exp:channel:month_links}
  • #7 / Jan 13, 2011 3:45am

    mgrothman

    10 posts

    Yes I am taking over the developer of the site. I am trying to figure out the most time efficient way of solving issues with certain aspects of the site not functioning, as well I have never developed in EE before. It isn’t helping that with the research I am doing into developing within the EE framework, the coding from the old developer is just not making sense.

    Thank you by the way, but removing the semicolon actually solved nothing.

  • #8 / Jan 13, 2011 3:57pm

    Ingmar

    29245 posts

    As John Henry said, it’d be easiest to just use something like http://example.com/blog/archives/2011/01/. You should be able to use {year} and {month_num} for that purpose. EE should automatically use such date-based URLs correctly.

  • #9 / Jan 13, 2011 7:19pm

    mgrothman

    10 posts

    Yes I already attempted this…

    Here is my current code:

    <div id="blog_dates">
      <h3>{segment_1} Dates</h3>
    <p>  <ul><br />
        {exp:channel:month_links channel="{segment_1}"}<br />
        <li><a href="http://{path={segment_1}/archives}">{month_long} {year}</a></li><br />
        {/exp:channel:month_links}<br />
      </ul><br />
    </div>

    I get a 404 error page, but the links look like they are correct?

    http://worldsavvy.org/blog/

    Here is an example of the link it is generating now:
    http://worldsavvy.org/blog/archives/2011/01

    Wondering if it is a problem with some redirect settings on the server?

    The {month_long} {year} output is not matching the links correctly either.

  • #10 / Jan 14, 2011 2:50pm

    Sue Crocker

    26054 posts

    Did you create a template called archives in the blog template group?

  • #11 / Jan 20, 2011 5:38am

    Ingmar

    29245 posts

    So I finally was able to decipher the issues and get both the month and category working properly. Thank you for your help on that.

    Now on to my next issue. Pagination.

    May I ask you to start a new thread for that? It’s generally preferred to keep issues in separate threads. I’ll just split off your posting to a new thread for now, thanks.

  • #12 / Jan 20, 2011 5:40am

    Ingmar

    29245 posts

    Closing this one for now. Split off second issue to here.

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

ExpressionEngine News!

#eecms, #events, #releases