We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52804
    • 36 Posts
    If I try and view an unpublished article in the Modx manager I get a blank white page. The php error log says.

    [26-Jul-2017 11:20:00 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character' in /home/vli/public_html/core/cache/includes/elements/modsnippet/90.include.cache.php:2
    Stack trace:
    #0 /home/vli/public_html/core/cache/includes/elements/modsnippet/90.include.cache.php(2): DateTime->__construct('0')
    #1 /home/vli/public_html/core/model/modx/modscript.class.php(70): include('/home/vli...')
    #2 /home/vli/public_html/core/model/modx/modparser.class.php(521): modScript->process('&date=`0`')
    #3 /home/vli/public_html/core/model/modx/modparser.class.php(250): modParser->processTag(Array, true)
    #4 /home/vli/public_html/core/model/modx/modresponse.class.php(69): modParser->processElementTags('', '<!DOCTYPE html>...', true, false, '[[', ']]', Array, 10)
    #5 /home/vli/public_html/core/model/modx/modrequest.class.php(137): modResponse->outputContent(Array)
    #6 /home/vli/home/venturelighting/public_html/core/cache/includes/elements/modsnippet/90.include.cache.php on line 2

    If I edit the unpublished article directly in `modx_site_content` and change `publishedon` from `0` to a valid timestamp e.g.. `1500973680` I can preview it OK even though the article remain unpublished. i.e.. `published` is `0`

    I have 2 separate websites running on different Modx installations and both have this problem. I'm running Modx 2.5.2 and the latest Articles 1.7.11-pl.

    Has anyone else encountered this or have any clues as to what might be wrong?

    This question has been answered by robh76. See the first response.

      • 53161
      • 130 Posts
      Why don't you use Collections? They are the new "Articles".
      Are you adding them in the manager, or directly into the DB?
      • discuss.answer
        • 52804
        • 36 Posts
        Quote from: stefany at Jul 26, 2017, 11:01 AM
        Why don't you use Collections? They are the new "Articles".
        Are you adding them in the manager, or directly into the DB?

        Thanks Stefany, I am actually using Collections in conjunction with Articles. I'm not sure that Collections on it's own has all the functionality of Articles which is specifically for blogs. That said I've just found a workaround to my problem which is to amend the 'publishdateformat' snippet like so:

        
        <?php
        //$date = new DateTime($date);
        //return $date->format('jS F Y');
        return $date;
        
        
          • 53161
          • 130 Posts
          Quote from: robh76 at Jul 26, 2017, 11:14 AM
          Quote from: stefany at Jul 26, 2017, 11:01 AM
          Why don't you use Collections? They are the new "Articles".
          Are you adding them in the manager, or directly into the DB?

          Thanks Stefany, I am actually using Collections in conjunction with Articles. I'm not sure that Collections on it's own has all the functionality of Articles which is specifically for blogs. That said I've just found a workaround to my problem which is to amend the 'publishdateformat' snippet like so:

          
          <!--?php
          //$date = new DateTime($date);
          //return $date--->format('jS F Y');
          return $date;
          
          

          Thanks for sharing the solution!