Here is a sample of how you might structure the middlebox file and its call.
PHP Code:
<?php //snippet to go in tpl_index_default.php and tpl_index_categories.php
if($this_is_home_page) require($template->get_template_dir('tpl_middlebox_controller.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_middlebox_controller.php');
?>
Define MIDDLEBOX_QTY in a define file.
PHP Code:
<?php
/**
* Page Template
*
* Centerboxes are called as necessary
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* /includes/templates/your_template/templates/tpl_middlebox_controller.php test gjh42 2010-09-20
*/
?>
<!-- Begin Main Page Middleboxes -->
<div id="navColumnMiddleWrapper">
<?php
for($i=1; $i<=MIDDLEBOX_QTY; $i++){
?>
<div class="middleBoxContainer" id="middlebox_<?php echo $i; ?>">
<h2 class="middleBoxHeading" id="middlebox<?php echo $i; ?>Heading"><?php echo constant('BOX_HEADING_MIDDLEBOX' . $i; ?></h2>
<div class="middleBoxContent" id="middlebox<?php echo $i; ?>Content">
<?php require zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', constant('FILENAME_DEFINE_MIDDLEBOX_' . $i), 'false');?>
</div></div>
<?php
}// /for ?>
</div>
<br class="clearBoth" />
<!-- End Main Page Middleboxes -->