We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42704
    • 29 Posts
    Hi everybody!
    I'm setting up a blog following the tutorial (http://rtfm.modx.com/display/revolution20/Creating+a+Blog+in+MODx+Revolution) on Modx.
    Now i'm having issues with the Archives section.
    I followed the steps the tutorial described but modx doens't seem to get the correct code.

    I'm gonna explain quickly what i did:

    First i pasted the following code into my blog template at the bottom:
    <h3>Archives</h3>
    <ul>
    [[!Archivist? &target=`18` &parents=`10,11`]]
    </ul>


    The code target's page 18 what in my case is my Archive rescourse.
    The code I pasted into my Archive Recourse is the following:
    [[!getPage?
      &element=`getArchives`
      &elementClass=`modSnippet`
      &tpl=`blogPost`
      &hideContainers=`1`
      &pageVarKey=`page`
      &parents=`10,11`
      &includeTVs=`1`
      &toPlaceholder=`Archives`
      &limit=`10`
      &cache=`0`
    ]]
     
    <h3>[[+arc_month_name]] [[+arc_year]] Archives</h3>
     
    [[+Archives]]
     
    [[!+page.nav:notempty=`
    <div class="paging"> 
    <ul class="pageList"> 
      [[!+page.nav]] 
    </ul> 
    </div>
    `]]
    


    Following the tutorial, I used the numbers 10 and 11 in my Parents tag since my blogposts are posted in categories who's names are 10 and 11.

    When I preview this page, everything shows up just fine. BUT! When i click inside a post on the archives link - i get send to the homepage.

    You can look here for more info or a Demo...
    www.innovarts.be
    I hope somebody can help me. I'm sorry for my bad English, Dutch is my native language.

    Kind Regards
    Simon
      • 38878
      • 255 Posts
      I checked out your site and did'nt see archives on your menu so I assume that resource is hidden, yes? If so, see reference from rtfm docs:

      If your getArchives call is not displaying any results and your resources are hidden from menus, make sure you specify the &showHidden=`1` parameter (inherited from getResource) parameter!

      That should fix you.
        • 42704
        • 29 Posts
        Hi Harvey EV,
        First of all, thanks for your time. Second,

        it's a fact that my "archives" page is hidden because otherwise it would appear in my navigation. Since I don't want "archives" to appear, I chose to keep it hidden. Now for the &showHidden parameter, I added it in my code, but it didn't solve my problem.
        When you click a post, you get redirected to the post itself. There you can choose for the archives. Clicking on the archives still gets you redirected to my home page. I guess it has something to do with the target parameter. My browser browses to a strange url after clicking so i guess that's the reason why you end up at the home page.
        So the problem stays the same.
        How to solve it?

        Note the url after clicking on "archives" becomes something like this:
        http://www.innovarts.be/index.php?id=182013/02

        i guess it should be something like this:
        http://www.innovarts.be/index.php?id=18

        because at 18 is my "archives" rescource

        Thanks in advance!
          • 38878
          • 255 Posts
          Actually the url you posted looks like a combination of not using friendly urls with the parameters being passed as url paths instead of arguments (&key=value). And of course it will be redirected to your index page because it ism't valid. For archives to work without friendly urls, you need to pass the arc_month and arc_year parameters. Without friendly urls turned on the url should look something like this:
          http://www.innovarts.be/index.php?id=18&arc_year=2013
          or
          http://www.innovarts.be/index.php?id=18&arc_year=2013&arc_month=02
          depending on whether you want to list by year or month and year.

          This looks like a typo or syntax issue to me. I would double check all of you snippet calls and template placeholders. That "'" vs "`" got me a few times. If you post anything you modified from the original package, and your versions of modx, articles and archives, that may help. Without that it's just guessing. I'd also suggest you check your friendly url settings and .htaccess file on your modx content root.

          Hope that helps.

          Quote from: smette at Feb 03, 2013, 06:37 AM
          Hi Harvey EV,
          First of all, thanks for your time. Second,

          it's a fact that my "archives" page is hidden because otherwise it would appear in my navigation. Since I don't want "archives" to appear, I chose to keep it hidden. Now for the &showHidden parameter, I added it in my code, but it didn't solve my problem.
          When you click a post, you get redirected to the post itself. There you can choose for the archives. Clicking on the archives still gets you redirected to my home page. I guess it has something to do with the target parameter. My browser browses to a strange url after clicking so i guess that's the reason why you end up at the home page.
          So the problem stays the same.
          How to solve it?

          Note the url after clicking on "archives" becomes something like this:
          http://www.innovarts.be/index.php?id=182013/02

          i guess it should be something like this:
          http://www.innovarts.be/index.php?id=18

          because at 18 is my "archives" rescource

          Thanks in advance!
            • 42704
            • 29 Posts
            How do I turn on friendly URL settings then?
            When i copy and paste the URL's you posted earlier they work perfectley so i guess there is something wrong with my getRecoursce

            How to change the arc_month and arc_year parameters?
              • 42704
              • 29 Posts
              I changed the settings to "use friendly URL's". Now my Blog page isn't available anymore... how come?