I appreciate the hand.. I prefer SNAF because while I know (based on the author) that "Flexible Product Listing" is very well written, my understanding is that "Flexible Product Listing" only applies a grid layout option to the product category listings. SNAF on the other hand also allows me to apply a grid layout to the Specials, New Products, All Products, and Featured Product listings as well.
That said, not sure if the change to the includes/templates/custom_template/common/tpl_tabular_display.php alone will work with SNAF.
SNAF makes modifications to both of these files:
includes/templates/custom_template/common/tpl_columnar_display.php
includes/templates/custom_template/common/tpl_tabular_display.php
Your posted edit to the includes/templates/custom_template/common/tpl_tabular_display.php is based on the default version.. the SNAF version of this file only makes one small edit to this file.. I've combined it with your edits and this is the result (SNAF changes are highlighted in red):
Code:
<?php
/**
* Common Template - tpl_tabular_display.php
*
* This file is used for generating tabular output where needed, based on the supplied array of table-cell contents.
*
* @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
* @version $Id: tpl_tabular_display.php 3957 2006-07-13 07:27:06Z drbyte $
*/
//print_r($list_box_contents);
$cell_scope = (!isset($cell_scope) || empty($cell_scope)) ? 'col' : $cell_scope;
$cell_title = (!isset($cell_title) || empty($cell_title)) ? 'list' : $cell_title;
?>
<div width="100%" id="<?php echo 'cat' . $cPath . 'Table'; ?>" class="tabTable">
<?php
for($row=1; $row<sizeof($list_box_contents); $row++) {
$r_params = "";
$c_params = "";
if (isset($list_box_contents[$row]['params'])) $r_params .= ' ' . $list_box_contents[$row]['params'];
?>
<div <?php echo $r_params; ?>>
<?php
for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
$c_params = "";
$cell_type = ($row==0) ? 'div' : 'div';
if ($current_listing_style == 'columns') $cell_type = 'td'; /*SNAF CHANGES*/
if (isset($list_box_contents[$row][$col]['params'])) $c_params .= ' ' . $list_box_contents[$row][$col]['params'];
if (isset($list_box_contents[$row][$col]['align']) && $list_box_contents[$row][$col]['align'] != '') $c_params .= ' align="' . $list_box_contents[$row][$col]['align'] . '"';
if ($cell_type=='div') $c_params .= ' scope="' . $cell_scope . '" id="' . $cell_title . 'Cell' . $row . '-' . $col.'"';
if (isset($list_box_contents[$row][$col]['text'])) {
?>
<?php echo '<' . $cell_type . $c_params . '>'; ?><?php echo $list_box_contents[$row][$col]['text'] ?><?php echo '</' . $cell_type . '>' . "\n"; ?>
<?php
}
}
?>
<br class="clearBoth" />
</div>
<?php
}
?>
</div>
I'm assuming that logically, this change should look like this to work with your edits:
Code:
if ($current_listing_style == 'columns') $cell_type = 'div'; /*SNAF CHANGES*/
However the listing grids for Specials, New Products, All Products, and Featured Product listings in SNAF comes from the changes to the includes/templates/custom_template/common/tpl_columnar_display.php file. This is the file with the major SNAF changes, and it's the one I'm unsure of how to convert..
Code:
<?php
/**
* Common Template - tpl_columnar_display.php
*
* This file is used for generating tabular output where needed, based on the supplied array of table-cell contents.
*
* @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
* @version $Id: tpl_columnar_display.php 3157 2006-03-10 23:24:22Z drbyte $
*/
?>
<?php
if ($title) {
?>
<?php echo $title; ?>
<?php
}
?>
<div class="centerBoxWrapperContents">
<table width="100%" align="center" cellpadding="1" cellspacing="15" border="0">
<?php
if (is_array($list_box_contents) > 0 ) {
$MaxCol=0;
for($row=0;$row<sizeof($list_box_contents);$row++) {
$params = "";
//if (isset($list_box_contents[$row]['params'])) $params .= ' ' . $list_box_contents[$row]['params'];
?>
<tr>
<?php
for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
$r_params = "";
if (isset($list_box_contents[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents[$row][$col]['params'];
$r_params = str_replace(" back", "", $r_params);
$r_params = str_replace("50", "100", $r_params);
$r_params = str_replace("33", "100", $r_params);
// bof: Replace all widths with 100% for Column Divider Pro
$startpos = strpos($r_params, "width:");
if ($startpos != false) {
$endpos = strpos($r_params, ";", $startpos);
$res = substr($r_params, $startpos, ($endpos - $startpos ));
$r_params = str_replace($res, "width:100%", $r_params);
}
// eof: Replace all widths with 100% for Column Divider Pro
if (isset($list_box_contents[$row][$col]['text'])) {
?>
<?php
echo '<td width="'. (intval($col_width) - 0.5) .'%" align="center" valign="top"><div' . $r_params . '>' . $list_box_contents[$row][$col]['text'] . '</div></td>' . "\n";
?>
<?php if ($row == 0 && $col < (sizeof($list_box_contents[$row]) - 1)) {
echo '<td class="vDotLine" rowspan="' . ((sizeof($list_box_contents))*2) . '"></td>' . "\n";
$MaxCol += 1;
}
}
}
?>
</tr>
<?php
if ($row < (sizeof($list_box_contents)-1)) {?>
<tr>
<?php for($col=0;$col<($MaxCol + 1);$col++) {
echo '<td class="hDotLine"></td>';
} ?>
</tr>
<?php }
?>
<?php
}
}
?>
</table>
</div>