Ratorasniki
Fri 5th Jan '01, 5:48pm
posted this in code hacks about a week back, but i figured y'all might like it as well:
to make your template.php create instantly useable templates from the form (instead of having to go into global.php and register them) open /admin/template.php and find
$DB_site->query("INSERT INTO template (templateid,title,template) VALUES (NULL,'".addslashes("$title")."','".addslashes("$template")."')");
under it add
# added template code
# echo "title is $title <br>"; # debugging
$filename = "rattemp.php";
$str = '<?php eval("\$';
$str .= $title;
$str .= ' = \"".gettemplate("';
$str .= $title;
$str .= '")."\";"); ?>';
$fp=fopen($filename, 'a+');
fwrite($fp,"$str \n");
fclose($fp);
# end
then open up global.php and find
eval("\$fivelinks = \"".gettemplate("fivelinks")."\";");
and under it add
require ("admin/rattemp.php");
now create an empty file called /admin/rattemp.php and upload it, make sure its CHMOD-ed to 666, and you're set. also note if you delete custom templates, this wont remove the reference from the rattemp.php file, you'll have to do that manually, but i did this for my design guy who isnt really one to go trekking through code when he wants to make a template :)
to make your template.php create instantly useable templates from the form (instead of having to go into global.php and register them) open /admin/template.php and find
$DB_site->query("INSERT INTO template (templateid,title,template) VALUES (NULL,'".addslashes("$title")."','".addslashes("$template")."')");
under it add
# added template code
# echo "title is $title <br>"; # debugging
$filename = "rattemp.php";
$str = '<?php eval("\$';
$str .= $title;
$str .= ' = \"".gettemplate("';
$str .= $title;
$str .= '")."\";"); ?>';
$fp=fopen($filename, 'a+');
fwrite($fp,"$str \n");
fclose($fp);
# end
then open up global.php and find
eval("\$fivelinks = \"".gettemplate("fivelinks")."\";");
and under it add
require ("admin/rattemp.php");
now create an empty file called /admin/rattemp.php and upload it, make sure its CHMOD-ed to 666, and you're set. also note if you delete custom templates, this wont remove the reference from the rattemp.php file, you'll have to do that manually, but i did this for my design guy who isnt really one to go trekking through code when he wants to make a template :)