3
Thanks for your reply. Here is an example of the index.php in the standard upload package, with includes that I have on one of my sites. This is the db connection and paths to the templates_c, templates, config and cache files. Notice that there are assigns ( ) and a display (index.tpl) at the bottom. The index.tpl can be changed to index.html. All the Smarty php pages I have seen are simular to this. If XOOPS has not index.tpl (or index.html) how does the PHP coding for the index.php get pulled through a template.
require_once("includes/ru_config.php");
require_once("includes/ru_connection.php");
require_once("includes/ru_data.php");
require_once("includes/ru_utils.php");
require_once("libs/ru_smarty.php");
$smarty->caching = true;
$smarty->compile_check = true;
$smarty->debugging = true;
RU_CheckInject();
$smarty = new RuSmarty;
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
$smarty->assign("option_selected", "NE");
//Setup the url var we are looking for to control page display
$page_var = 'page';
//Using the $_REQUEST scope so that the page can be passed in via $_POST or $_GET
$page_request = $_REQUEST[$page_var];
//This array holds the relationsip between the page variable and the template to load. This info could also be retrieved from a db
$menu = array ('home' => 'home.tpl','aboutus' => 'aboutus.tpl','links' => 'links.tpl','contactus' => 'contactus.tpl' );
//Check if the requested page was found in the menu
if(array_key_exists($page_request, $menu))
{
$template = $menu[$page_request];
}
else
{
//If not, set the default page
$template = 'home.tpl';
}
//print_r($menu);
//Assign info to Smarty and Display
$smarty->compile_id = $template;
//$smarty->caching = 1;
$smarty->assign('menu', $menu);
$smarty->assign('template', $template);
$smarty->assign('page_var', $page_var);
$smarty->assign_by_ref('users', $thepager->itemlist);
$smarty->assign_by_ref('thepager', $thepager);
$smarty->assign("content", $content);
$smarty->display("index.tpl");
?>