Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Compile Plugin Template File

Quote Reply
Compile Plugin Template File
I am writing a plugin where I use a template, which is added automatically to the templates/default/local directory (like in jagermans PrivatePostReply plugin).

Code:
# The following section will unarchive attached files into the
# proper location.
my $file;

# Copying templates/default/local/alt_search_results.html to $CFG->{admin_root_path} directory.
$file = $tar->get_file ('templates/default/local/alt_search_results.html');
$file->name("$CFG->{admin_root_path}/templates/default/local/alt_search_results.html");
$file->write or return AltSearch->error("Unable to extract file '$CFG->{admin_root_path}/templates/default/local/alt_search_results.html': $GT::Tar::error", 'WARN');

The template is saved OK, but it isn't compiled automatically. How can I make it to compile automatically? Right now, if have to go to the template editor and save it (which is annoying when developping....).

Thanks for any help.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Compile Plugin Template File In reply to
As soon as you parse the template with GT::Template, it will automatically (and transparently) compile the template for you. I could be completely off-base with what you are asking here though...

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [jagerman] Compile Plugin Template File In reply to
Thanks for the quick answer.

Yes, your're right. But the thing is that while I am testing, the template remains in place (i.e. it is not deleted when I uninstall the plugin, as in your example plugin I mentionned above). So when I re-install the plugin, the template itself is overwritten, but the compiled version is still the old one.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Compile Plugin Template File In reply to
As soon as you parse the page again, GT::Template will automatically delete the old compiled file and create a new one if it detects that the file has changed.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [jagerman] Compile Plugin Template File In reply to
somehow it doesn't.

Here is what I do: (You can try it with your PrivatePostReply plugin).
1) Install Plugin
2) Display template page
3) Uninstall Plugin
4) Edit template
5) Re-install
6) Display template page -> show the same as in 2)

I am still using v 1.0.0

Ivan
-----
Iyengar Yoga Resources / GT Plugins