Dear all,
I have to replace a split string by a php constant; but the string has text part concatenated with value of the variables. If I assign the concatenated string to a php constant, it does not evaluate the variable value when displayed. eg:
res = confirm("The file at " + filename.value + "is added to project(<? echo $varProjname ?>)" );
is to be replaced as:
res = confirm(<? echo $CONST_WHOLE_STRING ?>);
But when I replaced as above, the variable does not get evaluated and gives error.
So please help me in solving this problem of replacing a concatenated string with a php constant.
thanks
buddha
string and value concatenation to be assigned to a constant
Moderator: General Moderators
constants aren't preceded by the dollar sign...
Also, don't use php short tags (<? ?>) use the standard php tags instead (<?php ?>). PHP is dropping support for short tags ( I believe). They aren't available on all installs, (so they are not very portable), and I I'm pretty sure they cause problems with xml when enabled
Code: Select all
<?php
define('CONST_WHOLE_STRING', 'Value');
?>
res = confirm(<?php echo CONST_WHOLE_STRING; ?>);Code: Select all
<?xml version="1.0"?>