I am using VB to include 1 PHP file that is open to requests. These requests load the appropriate files if that's the page being requested. So, this allows a hook to be placed in global_start without actually loading a script and consuming enormous amounts of system resources. The 50,000+ pages are generated from about 10 scripts/programs.
In other words, I am using this script as a hook on global_start with a custom template that has the vb raw variable.
This is my PHP code (Master.php). Seems to work very well so far.
PHP Code:
<?php
global $fnuser,$fnuserid,$msxtotal;
$csl = $_GET['csl']; // Custom Script Location - Single Files with no directories. Mod rewrite on
if ($csl=='About-Us') {
require "C/about.shtml";
$fglink = "About Us";
$fgptitle = "About Our Business";
}
elseif ($csl=='Sitemap') {
require "C/sitemap.php";
$fglink = "Sitemap";
$fgptitle = "Website Sitemap";
}
mysql_select_db(vb);//Want to select back to VB database just in case another database was selected
?>
Included script on the hook (M.php):
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'Master');
define('CSRF_PROTECTION', true);
// change this depending on your filename
// ################### 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('CustomMaster',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$navbits = construct_navbits(array('' => $fglink));
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('CustomMaster');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $fgptitle);
$templater->register('sidebarext', $sidebarext);
$templater->register('sidebaropen', $sidebaropen);
print_output($templater->render());
?>
Mod-Rewrite Code:
Code:
RewriteRule ^C/([^/]+).php$ /FN/M.php?csl=$1 [QSA,L]
Then call it like M.php?csl=About-Us
Mod-Rewrite generates About-Us.php and you're done.