So Ive come back to this original thought, as on further thinking it really does have good uses.
Im fine on static titles, like category titles on a listing, or product titles and description on a product page, but when there is a listing with more than one product title or category title on a page (such as categories sidebox or a category listing lots of products, I get stuck.
If I do what ive been doing so far, I get one category in the side box to change its title, but then all the others vanish, like wise, I can get one product in a listing to change, and all the others vanish.
I assume because Im modifiying an array, and not a fixed string.
For example, in tpl_columnar display... I had a listing of 157 products, but this makes only one appear with the correct name, and the other 156 vanish off the page. Any ideas?
<?php
// The text string
$list_box_contents2[$row][$col] = $list_box_contents[$row][$col];
// The word we want to replace
$oldWordprodtitle = "oldword";
// The new word we want in place of the old one
$newWordprodtitle = "newword";
// Run through the text and replaces all occurrences of $oldText
$list_box_contents2[$row][$col] = str_replace($oldWordprodtitle , $newWordprodtitle , $list_box_contents2[$row][$col]);
?>
<?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
}
?>
<?php
if (is_array($list_box_contents) > 0 ) {
for($row=0;$row<sizeof($list_box_contents);$row++) {
$params = "";
//if (isset($list_box_contents[$row]['params'])) $params .= ' ' . $list_box_contents[$row]['params'];
?>
<?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'];
if (isset($list_box_contents[$row][$col]['text'])) {
?>
<?php echo '<div' . $r_params . '>' . $list_box_contents2[$row][$col]['text'] . '</div>' . "\n"; ?>
<?php
}
}
?>
<br class="clearBoth" />
<?php
}
}
?>