Log in

View Full Version : edit template with plugin


harmor19
10-21-2005, 03:05 PM
Is it possible to edit a template with a plugin?
Here's a code from another BBS that uses the plugin system

require "./inc/adminfunctions_templates.php";
find_replace_templatesets("header", '#help</a></li>#', "help</a></li><li><a href=\"\$settings[bburl]/\$settings[cpphpfn]\"><img src=\"\$theme[imgdir]/star.gif\" border=\"0\" alt=\"Custom Pages\">Custom Pages</a></li>");


"header" is the template it's editing,
It changes "#help</a></li>#" to help</a></li><li><a href=\"\$settings[bburl]/\$settings[cpphpfn]\"><img src=\"\$theme[imgdir]/star.gif\" border=\"0\" alt=\"Custom Pages\">Custom Pages</a></li>

Marco van Herwaarden
10-21-2005, 08:06 PM
I am doing it with some of my hacks.

The report PM module of the PM Workbench for example.

harmor19
10-21-2005, 08:15 PM
Thank you, I will look into take a look at them.

Paul M
10-21-2005, 08:53 PM
It is possible to do string replacements on the fly to templates in the cache, it's something I saw done quite a while ago and have included in one hack so far, and intend to update into a few others eventually.