Greg
06-23-2005, 03:40 PM
Here's a quick and dirty template to use vbulletin actions to do a job in one file, wizard.php.
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'wizard');
// #################### 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();
// pre-cache templates used by specific actions
// this is where you put the name of the templates each task uses
$actiontemplates = array(
'form' => array(
'main_template',
),
'calculate' => array(
'output_template',
),
);
if( empty($_POST['do']) )
{
$_POST['do'] = 'form';
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// display the form
if ($_POST['do'] == 'form')
{
// code here to display form
}
// calculate the results
if ($_POST['do'] == 'calculate')
{
// code here to caulate and show result
}
?>
http://www.some-site-somewhere.com/wizard.php will display the main form
having the following code in the form that is displayed by the above and clicking submit will bring up the result of calculate...
<form action="wizard.php" method="post">
What two numbers do you want to add?<br />
<input type="text" name="num1" size="10" maxlength="10" value="" /><br />
<input type="text" name="num2" size="10" maxlength="10" value="" /><br />
<input type="hidden" name="do" value="calculate" /><br />
<input type="submit" value="Calculate" /><br />
</form>
That's quick and dirty, this is a vBulletin 3.0.7 example. You should run the POST vars through globalize too.
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'wizard');
// #################### 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();
// pre-cache templates used by specific actions
// this is where you put the name of the templates each task uses
$actiontemplates = array(
'form' => array(
'main_template',
),
'calculate' => array(
'output_template',
),
);
if( empty($_POST['do']) )
{
$_POST['do'] = 'form';
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// display the form
if ($_POST['do'] == 'form')
{
// code here to display form
}
// calculate the results
if ($_POST['do'] == 'calculate')
{
// code here to caulate and show result
}
?>
http://www.some-site-somewhere.com/wizard.php will display the main form
having the following code in the form that is displayed by the above and clicking submit will bring up the result of calculate...
<form action="wizard.php" method="post">
What two numbers do you want to add?<br />
<input type="text" name="num1" size="10" maxlength="10" value="" /><br />
<input type="text" name="num2" size="10" maxlength="10" value="" /><br />
<input type="hidden" name="do" value="calculate" /><br />
<input type="submit" value="Calculate" /><br />
</form>
That's quick and dirty, this is a vBulletin 3.0.7 example. You should run the POST vars through globalize too.