I have a chunk called "PageContent" that looks like this:
<div id="article">
<div class="entry" id="entry[*id*]">
<h2>[*longtitle*]</h2>
<div class='subtitle'>[*subtitle*]</div>
<div class="date">[[FormatDate? &stamp=[*publishedby*] &format=`F j, Y`]]</div>
<div class="entryContent">
[[ContentParser]]
</div>
</div>
</div>
And a snippet called "FormatDate" that looks like this:
$stamp = isset($stamp) ? $stamp : time();
$format = isset($format) ? $format : 'F j, Y';
echo $stamp;
return date($format,$stamp);
When I place the chunk in a template, I get this error on the front end:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error: date() expects parameter 2 to be long, string given
Error type/ Nr.: Warning - 2
File: /home/.jazzmen/jlivingston/lab.tiltedsymmetry.com/manager/includes/document.parser.class.inc.php(705) : eval()'d code
Line: 4
Parser timing
MySQL: 0.1097 s s (18 Requests)
PHP: 0.4174 s s
Total: 0.5271 s s
What is the rendering order for MODx tags? If I call the snippet directly from the template, it works fine. And if I simply place the MODx tag "[*publishedby*]" in the chunk without trying to pass it to a snippet, it renders fine. But when the tag passes from the chunk to the snippet, it does so pre-rendered, so that my FormatDate snippet does not receive and actual timestamp.
EDIT: Oh, and if anyone wonders why I’m passing the "publishedby" parameter as a timestamp, it’s because that is currently what it is being used for in the database. It appears that "publishedby" and "publishedon" have somehow switched roles, because the "publishedon" field appears to contain user id’s.