We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41384
    • 2 Posts
    Many thanks to all who have posted above. I'm just learning MODX and found the solution to a problem in these posts.

    The only thing I wanted to add was that in getting this solution working I discovered advice on PHP.net that the use of 'urldecode' with $_GET is not necessary (and can be dangerous). I can confirm that I got the above examples working without the use of 'urldecode'. (See http://php.net/manual/en/function.urldecode.php)

    Cheers
      • 37693
      • 47 Posts
      shaunmorrison Reply #12, 14 years ago
      Okay, was building another MODx site and forgot how to set the blog titles up and I found this thread... which I started!

      Thanks David for informing us about urldecode + $_GET:

      I've adjusted the code like so
      <?php
      $pagetitle = $modx->resource->get('pagetitle');
      $get = $modx->sanitize($_GET);
      if (ISSET($get['tag'])){
          $tag=$get['tag'];
          return 'Posts tagged with'.$tag;
      }
      if (ISSET($get['arc_year'])){
          return 'Articles posted during '.date( 'F', mktime(0, 0, 0, $get['arc_month'])).' '.$get['arc_year'];
      }
      if(ISSET($pagetitle)) {
          return $pagetitle;
      }

      Note that it no longer inserts results into a placeholder, but it simply put the results wherever [[blogTitle]] is placed in the template. [ed. note: shaunmorrison last edited this post 14 years ago.]
        • 38188
        • 17 Posts
        Thanks for your code on this topic. I have a quick question, since i do not know much php, sorry. When i use the code you provided, and on archive page, I click on the year, instead of the month link (2012), it shows all the 2012 articles correctly, however the title says "Articles Posted During December 2012".

        Any suggestions how i could change this to "Articles Posted During 2012" instead?
        Thank you in advanced.