I'm trying to create a template which references variables from the meta plugin, but either it's not supported or I'm doing something wrong. This is what my template looks like:
<div class="attributionbox">
<p><b>Written by:</b> <a href="<TMPL_VAR AUTHORURL>"><TMPL_VAR AUTHOR></a></p>
<p><TMPL_VAR text></b></p>
</div>
The template is working because I get the content, but all the places where I reference meta variables are blank. Is this supposed to work or am I trying to do something unsupported? Many thanks for any pointers.
Cheers,
AdamShand
This isn't supported, because template templates don't run
pagetemplate
hooks (which is how information gets from meta into, for instance,page.tmpl
). The only inputs to theHTML::Template
are the parameters passed to the directive, plus theraw_
-prefixed versions of those, plus the extra parameters passed to everypreprocess
hook (currentlypage
,destpage
andpreview
).I think having
pagetemplate
hooks run for this sort of template by default would be rather astonishing, but perhaps some sort of opt-in while defining the template would be reasonable? One problem with that is that the templates used by template are just wiki pages, and don't really have any special syntax support.Thanks for the quick response! I'm trying to figure out some way that I can reference meta variables inside of a page. Specifically I'm trying to create an attribution box which lists all of the information I have about who wrote the page, where the original can be found etc. I can just pass the values to the template, but it would be really nice not have to put this information in for the meta plugin and my attribution box!
The changes you suggest sound wonderful but are beyond my abilities right row. Any ideas how I might accomplish this in the mean time?
\[[!meta]]
directive.smcv, sorry I don't understand? How are you getting the [[!meta] to work on a template page, I thought that's what you said didn't work? Do you mean a pagetemplate?
kerravonsen, thanks for the pointer I'll check those out.
I realised last night that I think I could also do this with a pagetemplate, since I should be able to access meta variables there. A little clumsy for what I want to do but should hopefully work fine. Would be really neat with the section template plugin, I'll have to look at that.