vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   help needed with template installer script (https://vborg.vbsupport.ru/showthread.php?t=75302)

Dep 01-28-2005 01:44 PM

help needed with template installer script
 
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&amp;only=1"><b>Click here to install ONLY the templates <font size="1"></font> --&gt;</b></a>';

}

// ##################### Insert Templates #########################
if ($_REQUEST['do'] == 'templates')
{

    foreach (
$maintemplates AS $name => $content)
    {
        
insert_template($name$content);
    }

    {
        
build_all_styles(00iif($_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. --&gt;</b></a><br />';

}

?>

many thanks in advance

Jolten 01-28-2005 06:19 PM

Categorizing the templates into their own group requires an edit to the includes/adminfunctions_tempalte.php file. It's not a database configuration thing.

Dep 01-28-2005 07:17 PM

just so ive got this right id goto

/forum/includes/adminfunctions_template.php

Find:
PHP Code:

'aaa' => 'AAA Old Backup' 

Above that Add:
PHP Code:

'Tester' => 'Testing Templates'

so all the templates i add must start with
Tester_

Jolten 01-29-2005 05:02 AM

yup That will work. Templates should start with Tester the _ won't be mandatory but it's helpful for visual reference sometimes.

Dep 01-29-2005 11:45 AM

great thanks alot


All times are GMT. The time now is 01:41 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00972 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete