Hey everyone!! I have had some great joy with this article, and it has helped me out a lot, but now I am wanting to do a bit more with it. I have now got so many custom pages that I was wondering if I could put them all together to pull up different templates.
For example...
radio.php would be the only PHP file I need to build.
Then I have a link to
radio.php?id=
status, that will pull up the
status template.
radio.php?id=
schedule, that will pull up the
schedule template
And so on.
This would then cut down the amount of pages I have on my web server, but keep what I have done already!!
I tried using the example above to no avil... not sure how that is supposed to work but it didn't!! I wonder if you could you the "if, elsif, else" solution on it though?
PHP Code:
<?php
.......
// pre-cache templates used by all actions
$globaltemplates = array('TEST',
'TEST2',
'TEST3',
);
........
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);
// ###### When do == 'xxx' #####
if ($_REQUEST['do'] == 'xxx')
{
$pagetitle = 'My Page Title';
$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
}
// ###### When do == 'yyy' #####
elseif ($_REQUEST['do'] == 'yyy')
{
$pagetitle = 'My Page Title';
$templater = vB_Template::create('TEST2');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
}
// ###### When do does not equal 'xxx' or 'yyy' #####
$pagetitle = 'My Page Title';
$templater = vB_Template::create('TEST3');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
Any help would be greatly appreciated, so thanks in advance!!