I created a filter under Drupal 5.7 and could use a little feedback.
Name: Revision Notation
Description: Prints "Last revised on" notation.
Pattern: /\[revision\]/i
Replacement text: <div align="right" class="caption"><?php print t('Last Revision: ') . format_date($node->changed, 'custom', "F jS, Y"); ?></div>
PHP checkbox: checked
When I preview a node with it, the viewport is entirely blank. Do I need to format my PHP differently?
Comments
Comment #1
silurius commentedForgot to mention, this same code works fine when added to node.tpl.php.
I've used it in both Filtered HTML and PHP code input formats with the same result. My Filtered HTML filter ranking is:
(similar to PHP code filter ranking)
I moved this filter up to -1 and this did not seem to affect anything.
Comment #2
arhip commentedThe replacement text should be:
The format of replacement text you provide is a feature that I plan to implement but still have no time to work in that.
Hope it helps.
Patches are welcome :)
Comment #3
silurius commentedSuccess, sort of. I'm sure it isn't the fault of the module, but it appears that when code like this is used in this way, the date and time is: "December 31st, 1969" (beginning of Unix epoch?). When the code I posted above is used in node.tpl.php instead, it actually grabs the date the node is saved, so I think it's just a difference in how the the query is being executed. What does MySQL see in this case? Let me know if you need me to create a new issue for this one.
Comment #4
arhip commentedI've tried the replacement rule and the date shown is January 1st, 1970. I've checked
$GLOBALS, seems that during filter process$nodehadn't been loaded yet. But when the code used in node.tpl.php,$nodehad been loaded, so it worked.Now I'm trying using node_load hook.
Ok, I think I need you to create a new issue.
Thanks.
Comment #5
silurius commentedOk, I've created a new issue. Feel free to close this one.
Comment #6
avpaderno