We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30051
    • 14 Posts
    Well those dates previously mention are not the same dates (they are but I deleted all item but three just to have a more overviewable list).


    with news.config.php:
    <?php
    $parents = 2;
    $tpl = ’news_item’;
    $orderBy = ’pub_date DESC’;
    $debug = ’1’;
    //$orderBy = array(’parsed’=>array(), ’custom’=>array(), ’unparsed’=>publishedby DESC);
    ?>

    I get:

    PHP error debug
    Error: Invalid argument supplied for foreach()
    Error type/ Nr.: Warning - 2
    File: /srv/www/htdocs/greyamsterdam.com/modx/assets/snippets/ditto/classes/ditto.class.inc.php
    Line: 158
    Line 158 source: foreach ($orderBy[’parsed’] as $item) {

    Parser timing
    MySQL: 0.0019 s (3 Requests)
    PHP: 0.0251 s
    Total: 0.0270 s



    Another thing I’ve seen recently is that my menu structure tree first comes out EMPTY.
    Every time I log in I have to use the "sort the site tree" function, to make it visible.
    Messy in itself, might also mess the above up possibily?
      • 16278
      • 928 Posts
      As previously, $orderBy = ’pub_date DESC’; won’t work in a config file - it’s the cause of the PHP error here. And I’m not sure you can set $debug=’1’ in a config file, either. I suggest you go back to setting of parameters in your snippet call, with &orderBy=`pub_date DESC` and &debug=`1`, and see what teh debug output tells you. Though the other problem you mention may well indicate you have more fundamental problems with the site.
      sad KP