We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36805
    • 354 Posts
    I want to efficiently display articles from a database table source using evolution.

    Endusers can retrieve one at a time trough a single modx document which serves them all. A simple GET argument determines which article id needs to be retrieved, like www.mydomain.com/index.php?id=12&article=111

    In that document I could use a snippet ’fetchArticle’ to retrieve the data

    1. Is it possible to pass $_GET[’article’] as a snippet parameter?
    2. Can i use default cache mechanism to cache multiple articles?

    I have a feeling #2 may not be possible, i think snippet caching isn’t designed in a way that allows multiple caches, correct me if I’m wrong
      • 18913
      • 654 Posts
      re: #1 Yes, you could pass it as a parameter in a call to "runSnippet". This from one of the API pages :


      $params[’param1’] = ’value1’;
      $params[’param2’] = ’value2’;

      $html = $modx->runSnippet(’mysnippet’, $params);

      Matt
        • 36805
        • 354 Posts
        Quote from: mconsidine at Feb 08, 2011, 10:07 AM

        re: #1 Yes, you could pass it as a parameter in a call to "runSnippet". This from one of the API pages :
        That would make it uncached for sure. I probably need to go that route anyway. Maybe I can come up with some caching through something 3rd party or roll my own like mary did at codingpad.

        Any advice on this is most welcome.