We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26313
    • 3 Posts
    Здраствуйте.
    У меня следующая проблема, мне надо сделать выборку документов и их содержимого независимо от того
    опубликован документ или нет.
    Функции которые могли б мне помочь - getDocumentChildren(),getDocuments(),getDocument()
    но в параметрах надо указывать $published, а мне это не подходит, так как надо выбрать и опубликованные и неопубликованные документы, как можно решить данную проблему ?
    версия MODx - 0.9.6
    буду благодарен любой помоще

    ----------------------------------------------------------------
    Hello
    I have a such problem:
    I should get the list of documents together with their contents (published and unpublished too)
    But next functions - getDocumentChildren(),getDocuments(),getDocument() require parameter $published - this is no good smiley
    MODx version - 0.9.6
    I’ll be very grateful for help

      • 3749
      • 24,544 Posts
      What you want is possible in MODx Revolution. In MODx Evolution, you need to search for both published and unpublished in separate calls and then merge the results. Or write your own query using the DB API something like this: (untested).

      <?php
      $output = '';
      $result = $modx->db->query( 'SELECT id, pagetitle, FROM `site_content` ORDER BY id ASC' );
       
      while( $row = $modx->db->getRow( $result ) ) {
      	$output .= '<br /> ID: ' . $row['id'] . '<br /> Name: ' . $row['pagetitle'] . '<br />---------<br />';
      }
      return $output;
      ?>
        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
        • 26313
        • 3 Posts
        thanks a lot!