View Single Post
  #1  
Old 01-28-2005, 01:44 PM
Dep Dep is offline
 
Join Date: Aug 2003
Location: uk
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01153 seconds
  • Memory Usage 1,798KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete