You can't put multiple lines of PHP inside an array statement like that. I would move the testing to above the array line, and insert its outcome into the array.
PHP Code:
$cat_noprod_text = TEXT_NO_PRODUCTS;
if(defined('TEXT_NO_PRODUCTS' . $listing->fields['master_categories_id']) {
$cat_noprod_text = constant('TEXT_NO_PRODUCTS' . $listing->fields['master_categories_id']);
}
//or the more compact version
$cat_noprod_text = (defined('TEXT_NO_PRODUCTS_' . $listing->fields['master_categories_id'])? constant('TEXT_NO_PRODUCTS_' . $listing->fields['master_categories_id']): TEXT_NO_PRODUCTS;
//and the insertion
'text' => $cat_noprod_text);
PHP Code:
} else {
$cat_noprod_text = (defined('TEXT_NO_PRODUCTS_' . $listing->fields['master_categories_id'])? constant('TEXT_NO_PRODUCTS_' . $listing->fields['master_categories_id']): TEXT_NO_PRODUCTS;
$list_box_contents = array();
$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
'text' => $cat_noprod_text);
Make a new file /includes/languages/english/extra_definitions/no_products_defines.php
PHP Code:
<?php
//text for different categories when no products
define('TEXT_NO_PRODUCTS_23', 'Category 23 is out of products right now.');
define('TEXT_NO_PRODUCTS_27', 'Category 27 is fresh out of products - we\'ll have more soon.');
Bookmarks