Jump to content

Please Help Echoing Constant


lingo5

Recommended Posts

hi, I have the PHP code below wher I'm trying to echo the contant CNT_TXT_EMPTYMESSAGE.

i have trie everything...with double quotes...single...with nothing...everything but nothing seems to work.

Am i using the correct syntax to do this?

Many thanks

 

<?php

include_once('config.php');
if (!$config['currencyCode']) $config['currencyCode']					 = 'EUR';
if (!$config['text']['cartTitle']) $config['text']['cartTitle']		 = 'Shopping Cart';
if (!$config['text']['singleItem']) $config['text']['singleItem']		 = 'Item';
if (!$config['text']['multipleItems']) $config['text']['multipleItems'] = 'Items';
if (!$config['text']['subtotal']) $config['text']['subtotal']			 = 'Subtotal';
if (!$config['text']['update']) $config['text']['update']				 = 'update';
if (!$config['text']['checkout']) $config['text']['checkout']			 = 'checkout';
if (!$config['text']['checkoutPaypal']) $config['text']['checkoutPaypal'] = 'Checkout with PayPal';
if (!$config['text']['removeLink']) $config['text']['removeLink']		 = 'remove';
if (!$config['text']['emptyButton']) $config['text']['emptyButton']	 = 'empty';
if (!$config['text']['emptyMessage']) $config['text']['emptyMessage']	 = '.CNT_TXT_EMPTYMESSAGE.';
if (!$config['text']['itemAdded']) $config['text']['itemAdded']		 = 'Item added!';
if (!$config['text']['priceError']) $config['text']['priceError']		 = 'Invalid price format!';
if (!$config['text']['quantityError']) $config['text']['quantityError'] = 'Item quantities must be whole numbers!';
if (!$config['text']['checkoutError']) $config['text']['checkoutError'] = 'Your order could not be processed!';
if ($_GET['ajax'] == 'true') {
header('Content-type: application/json; charset=utf-8');
echo json_encode($config);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/269912-please-help-echoing-constant/
Share on other sites

weird...

i was including the php file where all my constants are defined at the top of each page like so:

 

include ('../constants.php');

 

I have changed this to

 

include ('constants.php');

 

..and it works now !!!. How come....my constants.php file is one dir up...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.