PHP Plugin Doesn't pass document headers
ricky opened this issue · comments
As described in the wiki, layouts should have access to variables set in both documents and the layout itself. This is true, for example, of eco
templates. The php plugin appears to discard most of templateData
, saving only file metadata (i.e. the layout itself) to the $document
variable.
A naive patch is include below, mostly for illustrative purposes. I'll admit to not having sufficiently examined docpad's source to be able to offer a more elegant solution yet.
index db5a3ae..b513c65 100644
--- a/plugins/php/php.plugin.coffee
+++ b/plugins/php/php.plugin.coffee
@@ -30,6 +30,16 @@ module.exports = (BasePlugin) ->
#{data}
EOF;
$document = json_decode($document,true);
+
+ $templateHeader = <<<EOF
+ #{templateData.document.header}
+ EOF;
+ $templateHeader = explode("\n", trim($te
+ foreach ($templateHeader as $header)
+ {
+ $headerline = explode(":", $head
+ $document[trim($headerline[0])]
+ }
?>
#{content}
closing due to age