1
smarty2
xoops index.php
  • 2007/7/29 6:25

  • smarty2

  • Just popping in

  • Posts: 2

  • Since: 2007/7/29


Just starting my XOOPS adventure and after reading the docs and tutorials and such, I believe I have the basic "method of the maddness" figured out. The Module/Block templates are included in the Theme Templates. I believe the theme.html template, combines all the other theme templates together and delivers the page to the front end. Normally, using smarty, the index.php (as well as other .php pages) have the standard smarty includes (cache, templates, templates_c, config) and assigns variables as well as displays a index.tpl I am sure somehow XOOPS is doing this, but can you help me out by an explaination using the XOOPS root index.php code I have pasted below.

include "mainfile.php";

//check if start page is defined
if ( isset($xoopsConfig['startpage']) && $xoopsConfig['startpage'] != "" && $xoopsConfig['startpage'] != "--" ) {
header('Location: '.XOOPS_URL.'/modules/'.$xoopsConfig['startpage'].'/');
exit();
} else {
$xoopsOption['show_cblock'] =1;
include "header.php";
}

Another thing I would like confirmed, is that the /themes is the same as smarty /templates, only renamed. So, in effect, you have two different types of Smarty Template concepts, a. one for the blocks/modules and b. one for the themes. Where is the path for these two template directories at? Where are the Smarty includes at?

2
ewonline
Re: xoops index.php
  • 2007/7/29 16:09

  • ewonline

  • Not too shy to talk

  • Posts: 198

  • Since: 2004/11/17


There is no index.tpl btw. XOOPS doesn't name template files with .tpl.
Modules' template are in /modules/NAME/templates/
Modules' block templates are in /modules/NAME/templates/blocks

What do you mean exactly by smarty includes?
The smarty files are in /class/smarty/
Resized Image

3
smarty2
Re: xoops index.php
  • 2007/7/29 18:49

  • smarty2

  • Just popping in

  • Posts: 2

  • Since: 2007/7/29


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");
?>

Login

Who's Online

281 user(s) are online (249 user(s) are browsing Support Forums)


Members: 0


Guests: 281


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits