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-07-2006, 04:02 PM
vietkieu_cz vietkieu_cz is offline
 
Join Date: Dec 2005
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help

Help me with Creating Custon Sub-Pages.
I've asked here but nobody answered me.(https://vborg.vbsupport.ru/showthrea...stpost&t=98009)
I want to create a sub-custom page -
I read here but did not understand
Quote:
Creating "Subpages"

If you want to create "subpages" within your custom page, simply wrap blocks of code with the following structure:


PHP Code:
if ($_REQUEST['do'] == 'test')  
{  
    
// Block of code #1 


if (
$_REQUEST['do'] == 'test2')  
{  
    
// Block of code #2 

Where do I add Php Code?
How I create subpages in AdminCP (Templates)?
Get the Link to Subpages? ...test.php?page=2 ???
Reply With Quote
  #2  
Old 01-08-2006, 02:13 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

let's say you named your script "test.php"

PHP Code:
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT''test'); 

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
        
// change the lines below to the list of actual templates used in the script
        
'test_mytesttemplate1',
        
'test_mytesttemplate2',
        
'test_mytesttemplate3',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude str_replace('clientscript'$vbulletin->options['bburl'] . '/clientscript'$headinclude);

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

$navbits = array(); 
// change the line below to contain whatever you want to show in the navbar (title of your custom page)


if (empty($_REQUEST['do']))
{
   
$_REQUEST['do'] = "main";
}

//test.php
if ($_REQUEST['do'] == "main")
{
$navbits[$parent] = 'Main Page';

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' fetch_template('test_mytesttemplate1') . '");');
}

//test.php?do=test
if ($_REQUEST['do'] == "test")
{
$navbits[$parent] = 'Test Page';

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' fetch_template('test_mytesttemplate2') . '");');
}

//test.php?do=test2
if ($_REQUEST['do'] == "test2")
{
$navbits[$parent] = 'Test Page 2';

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' fetch_template('test_mytesttemplate3') . '");');
}

?>
Reply With Quote
  #3  
Old 01-25-2006, 01:22 PM
vietkieu_cz vietkieu_cz is offline
 
Join Date: Dec 2005
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks harmor19
Now I want to add custom template
e.x.:
in my template test_mytesttemplate1, there I add $customtemp
then i add a new temp. called customtemp
now what I have to add in my test.php script?
Reply With Quote
  #4  
Old 01-25-2006, 02:30 PM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use
eval('$customtemp = "' . fetch_template('customtemp') . '";');

Place this in the same subpage where the template where you would like the html of "customtemp" to be.

In this case you want to place the new template function in this section.

PHP Code:
if ($_REQUEST['do'] == "main"

$navbits[$parent] = 'Main Page'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 

// change the line below to contain the name of the actual main output template used in your script 
eval('print_output("' fetch_template('test_mytesttemplate1') . '");'); 

It doesn't matter where you put it but I would suggest above the existing fetch_template function.

PHP Code:
if ($_REQUEST['do'] == "main"

$navbits[$parent] = 'Main Page'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 

eval(
'$customtemp = "' fetch_template('customtemp') . '";'); 

// change the line below to contain the name of the actual main output template used in your script 
eval('print_output("' fetch_template('test_mytesttemplate1') . '");'); 

I'll explain how a fetch_template function with a variable works.

[COLOR=Red]eval('$customtemp = "' . fetch_template('customtemp') . '";');

The "$customtemp" variable is what you put in another template file.

So in the "test_mytesttemplate1" template you should have the variable "$customtemp".

The text in side the "fetch_template" function (which is "customtemp") is the template it's getting the html from.
Reply With Quote
  #5  
Old 01-30-2006, 10:55 AM
vietkieu_cz vietkieu_cz is offline
 
Join Date: Dec 2005
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you harmor again

I need a code for my custom page, which connects to phpmyadmin and gets the term of a post (e.x. id of post 1)
can you help me?

- sorry for my bad english
thanks
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 06:19 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04523 seconds
  • Memory Usage 2,233KB
  • 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
  • (4)bbcode_php
  • (1)bbcode_quote
  • (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