Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 01-28-2005, 06:19 PM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Categorizing the templates into their own group requires an edit to the includes/adminfunctions_tempalte.php file. It's not a database configuration thing.
Reply With Quote
  #3  
Old 01-28-2005, 07:17 PM
Dep Dep is offline
 
Join Date: Aug 2003
Location: uk
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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_
Reply With Quote
  #4  
Old 01-29-2005, 05:02 AM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yup That will work. Templates should start with Tester the _ won't be mandatory but it's helpful for visual reference sometimes.
Reply With Quote
  #5  
Old 01-29-2005, 11:45 AM
Dep Dep is offline
 
Join Date: Aug 2003
Location: uk
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great thanks alot
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:21 PM.


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.03479 seconds
  • Memory Usage 2,218KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete