ok im just starting to work this out. i got it to place the templates onto the style. Just wondering how do i make the templates go into there own sub heading rather then having them all listed right at the top of the template section in admin
my script so far looks like
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
require_once('./global.php');
require_once('./includes/adminfunctions_template.php');
$scriptname = 'BETA';
$version = '0.1';
print_cp_header('dep Templater ' . $scriptname . ' Install', '', '<style type="text/css">
<!--
.redalert
{
background: #FF0000;
color: #000000;
}
-->
</style>');
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'home';
}
// ##################### Make Template Function #####################
function insert_template($name, $content)
{
global $DB_site;
$template = compile_template($content);
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "template WHERE title = '$name' AND styleid = '-1'");
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "template (templateid, title, template, template_un, styleid, templatetype, dateline, username, version) VALUES (NULL, '$name', '" . addslashes($template) . "', '" . addslashes($content) ."', '-1', 'template', '" . time() . "', 'dep', '3.0.6')");
echo '<span class="smallfont">Created Template - ' . $name . '</span><br />';
}
// ####################### Templates ################################
$maintemplates = array(
'template_title_1' =>
'template text',
'template_title_2' =>
'template text'
);
// #################### Main Welcome Page ########################
if ($_REQUEST['do'] == 'home')
{
echo '<p><b>Welcome to dep template installler.</b><br /><br />';
echo '<a href="?do=templates&only=1"><b>Click here to install ONLY the templates <font size="1"></font> --></b></a>';
}
// ##################### Insert Templates #########################
if ($_REQUEST['do'] == 'templates')
{
foreach ($maintemplates AS $name => $content)
{
insert_template($name, $content);
}
{
build_all_styles(0, 0, iif($_REQUEST['only'], 'template_install.php' . '?do=finished'));
}
}
// ############################ Last Step #############################
if ($_REQUEST['do'] == 'finished')
{
echo 'dep ' . $scriptname . ' installation complete!<br /><br />';
echo '<font size="3" color="red"><b>You should now delete this file from your admincp directory.<br />Leaving this file here could be a security risk!</b></font><br /><br />';
echo '<a href="index.php"><b>Click here to log into your Admin CP. --></b></a><br />';
}
?>
many thanks in advance