We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4041
    • 788 Posts
    Just another EVO sample... smiley
    <?php
    $where ="createdby='".$modx->documentObject['createdby']."' AND isfolder='1' AND parent!='0' AND published='1'";
    $result = $modx->db->makeArray($modx->db->select("id,pagetitle",$modx->getFullTableName('site_content'),$where,''));
    
    if( $result ){
        $output ='The author of this article has written articles in the following categories: ';
        for( $x=0; $x<count($result); $x++ ) {
            $output .= '<a href="[~'.$result[$x]['id'].'~]">'.$result[$x]['pagetitle'].'</a>'.($x < count($result)-1 ? ', ' : '');
        }
        return $output;
    }
    ?>
      xforum
      http://frsbuilders.net (under construction) forum for evolution
      • 28215
      • 4,149 Posts
      Quote from: Breezer at May 02, 2011, 01:30 PM

      Just another EVO sample... smiley
      <?php
      $where ="createdby='".$modx->documentObject['createdby']."' AND isfolder='1' AND parent!='0' AND published='1'";
      $result = $modx->db->makeArray($modx->db->select("id,pagetitle",$modx->getFullTableName('site_content'),$where,''));
      
      if( $result ){
          $output ='The author of this article has written articles in the following categories: ';
          for( $x=0; $x<count($result); $x++ ) {
              $output .= '<a href="[~'.$result[$x]['id'].'~]">'.$result[$x]['pagetitle'].'</a>'.($x < count($result)-1 ? ', ' : '');
          }
          return $output;
      }
      ?>

      $c = $modx->newQuery('modResource');
      $c->where(array(
          'createdby' => $modx->resource->get('createdby'),
          'isfolder' => true,
          'parent:!=' => 0,
          'published' => true,
      ));
      $c->select(array('id','pagetitle'));
      $resources = $modx->getCollection('modResource',$c);
      $o = '';
      if (!empty($resources)) {
        $o = array();
        foreach ($resources as $resource) {
           $o[] = '<a href="'.$modx->makeUrl($resource->get('id')).'">'.$resource->get('pagetitle').'</a>'."\n";
        }
        $o = 'The author of this article has written articles in the following categories: '.implode(',',$o);
      }
      return $o;


      Win!

      Plus, this is also future-compatible, works on MSSQL/MySQL/any other drivers we develop, and will work if we ever rename the modx_* table fields. Oh, and the data’s automatically sanitized.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 17499 ☆ A M B ☆
        • 872 Posts
        Quote from: cyclissmo at May 02, 2011, 01:04 PM

        Do you need to include one more line:
        $c->bindGraph('{"CreatedResources":{"Parent":{}}}');

        smiley

        Nope smiley

        The second paramater or getCollectionGraph (or getObjectGraph) is already given (check here: http://rtfm.modx.com/display/xPDO20/getCollectionGraph)

        In this case, i would use bindGraph only if i wanted to check/test the query before using it :

        <?php
        $c = $modx->newQuery('modResource');
        $c->select('modResource.*, Parent.pagetitle as category');
        $c->where(array('Parent.parent != 0', 'CreatedResources.createdby ' => $modx->resource->get('createdby')));
        $c->groupBy('Parent.pagetitle');
        /* Check the query output */
        $c->bindGraph('{"CreatedResources":{"Parent":{}}}');
        $c->prepare();
        echo $c->toSQL();
        
          • 30023
          • 172 Posts
          Quote from: cyclissmo at May 02, 2011, 10:57 AM

          Quote from: TimGS

          You are in a different situation from me though. I already know Evo well, and see no benefit in switching. Despite the above, I don’t think Revo’s bad (but I don’t see it as being better.)
          But to say that the flagship MODx product is on equal grounds (or inferior) to its older, aging sibling is a pretty ludicrous statement IMHO. shocked

          IMHO, you are missing the point here...

          Evo shouldn’t be regarded as a step backwards if its better for you (I’m not saying this is the case for yourself - only you can decide that one!).

          ...which is what I wrote on page 4 of this thread and I still stand by it.

          If there are any conclusions to be drawn from the widely varying views here its that different people with different requirements and - just as importantly - different ways of working, will choose differently in terms of Evo vs. Revo (and also vs. something non-MODx vs. 100% bespoke coding).

          Just because something is a ’flagship’ or ’newer’ doesn’t mean better. It may well be better for you, which is great, but I didn’t find that to be the case for myself (and I appear to be no more alone in this than you are in your view).

          -- Tim.



            • 35978
            • 1 Posts
            Let me state the logic behind evo and revo. First Revolutionary characterized over all changes. Say If you want to have a new set up application to replace the system you are currently using then that’s the revo. And Evolution means the same thing with some specific changes or a make over of your current setting/system. From this point of view, I hope you can perfectly choose between the 2. wink
              • 21417
              • 486 Posts
              Hi All,

              It's been 8 months since the last comment on this thread and I don't mean to flog a dead horse but I think the Evo vs Revo question is getting more relevant.

              The last Evo 1.0.5 update was Jan 2011. Is that the end of the Evo era?

              I am just about to start building a couple of new websites and would love to keep using Evo - but I am concerned to do so if it is slowly becoming obsolete.

              ps Is susan still using evo?
                Web design Adelaide
                http://gocreate.com.au
                • 3749
                • 24,544 Posts
                AFAIK, Evo 1.0.6 is due out in the near future.


                ---------------------------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                MODX info for everyone: http://bobsguides.com/modx.html
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Right now I'm trying to get a grip on Revo development, but it's heavy going. At least twice a day I ask myself why I'm putting myself through the grief. To be honest, I'd personally much prefer be spending this time working on improving Evo, but I promised myself six months on Revo before going back to Evo. So in June I'll be back working full-time on my plan for world domination with a new, improved Evo. MODxLite, anybody?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 37099
                    • 338 Posts
                    I still like Evo. I've built sites in Revo and Evo. I'm just starting a new site in Evo because it has everything I need for this particular site. And it just feels a lot more light weight (in a good way) in terms of code and effort. I can develop a custom module in Evo a lot faster than I can develop a CMP in Revo and it just seems a lot easier and less complicated.
                      • 36416
                      • 589 Posts
                      If only there was a bit more (transparent) activity on GitHub, now we have situation that caretakers go back to project only a couple times per year when serious vulnerabilities are discovered...