Am i right in thinking there's no way to declare a global variable, assigned to a template->get that can be used in the header, through a plugin?
global_start is before templates is defined, and global_end is after the header is defined, so am i screwed? or is there something i'm missing apart from just editing the php?
Use the pre_output_page or post_output_page hooks output_page function in functions.php
you cant update a template already parsed but you can use a string replace on the already parsed template before it is output to the browser.
Like insert "<myplaceholder>" in the template you want to update, then your plugin will create a string variable that you then replace <myplaceholder> with in the HTML available in that hook
(2014-09-03, 11:30 PM)pavemen Wrote: [ -> ]Use the pre_output_page or post_output_page hooks output_page function in functions.php
you cant update a template already parsed but you can use a string replace on the already parsed template before it is output to the browser.
Like insert "<myplaceholder>" in the template you want to update, then your plugin will create a string variable that you then replace <myplaceholder> with in the HTML available in that hook
That's a very interesting way to do it, i will have a look, thanks
(2014-09-03, 11:51 PM)Destroy666 Wrote: [ -> ]You can also use the new global_intermediate hook (if the code is for 1.8 only): https://github.com/mybb/mybb/blob/featur...l.php#L436 Everything you may need is defined before it - $templates, $theme, etc. And every template is eval'd after it.
The plugin is for a personal site, not to be released, so i can go to whatever version is necessary
that sounds like a nice hook, i will consider updating
is 1.8 a dev version? i'm quite new to MyBB so i'm unfamiliar with the update system
EDIT: sorry, just seen on the site that 1.8 was released 3 days ago
will update later today
(2014-09-03, 11:51 PM)Destroy666 Wrote: [ -> ]You can also use the new global_intermediate hook (if the code is for 1.8 only): https://github.com/mybb/mybb/blob/featur...l.php#L436 Everything you may need is defined before it - $templates, $theme, etc. And every template is eval'd after it.
That will save a ton of effort for several plugins! Nice addition.