Forum Moderators: coopster

Message Too Old, No Replies

unexpected T constant encapsed string - (new case)

         

JonNewbie

9:26 am on Sep 28, 2007 (gmt 0)

10+ Year Member



Hi ,

I am back again with a new problem of the above error message.
The affected section of the script is as follows with the first line as line 23 :

require((DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS;?>>
<head>
<meta http-equiv="Content-Type" content="text/html charset=<?php echo CHARSET;?>">

line 30---<title><?php echo TITLE;?> : <?php if (isset($HTTP_GET_VARS['manufacturers_id'])) {.....

(1) I received the first error message for line 23 as :
" Warning : main(/includes/languages/english/index.php [function.main] failed to open stream : No such file or directory in/home/jon2007/public_html/index.php on line 23"

(2) I then changed line 23 to :
require('includes/languages/'.$language.'.'/'.'.FILENAME DEFAULT'). The original error message was solved but a new error message appeared :

"Parse error:syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/jon2007/public_html/index.php on line 30 "

(3) Drawing from previous experience, I would expect the error to occur before line 30 , from line 23 to line 29 but I did see any errors.

Can someone please help me spot where the trouble is?
Thanks in advance.

Best regards,
John Newbie

dreamcatcher

9:29 am on Sep 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi John,

You have one too many parenthesis on the original line:

require((DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

Should have been:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

dc

JonNewbie

10:18 am on Sep 28, 2007 (gmt 0)

10+ Year Member



Hi DC,

Thanks for your speedy reply. Actually the "double front opening brackets" of the require statement is my typo error. The original script has only a single bracket, and I still get the error message.

However, the good news is that after experimenting with format 5 minutes ago, I found the answer. The correct require statement
should be

require(/includes/languages/'.$language.'/'.FILENAME_DEFAULT)

The trick is not to put an inverted comma at the end of FILENAME_DEFAULT...as in

require(/includes/languages/'.$language.'/'.FILENAME_DEFAULT')

Please bear with me or correct me if I am wrong, since I am a newbie....it seems this reuire statement is a combination of directory path ('includes/languages) and the concatenation string operator ('.').

Therefore the front portion of the require statement needs to satisfy the file directory requirement, while the second portion needs to satisfy the concatenation string operator syntax.

With this solution, I have escaped parse error ; syntax error message for line 30, and now "progressed" to error on line 53!
I just realised that this store software program is full of errors! Anyway, thanks guys for your help, and as I move along, I will surely need your help at my next "road-block". I also hope to share whatever amount I have learnt.

Yahooo!

Best regards,
Jon Newbie

jatar_k

11:52 am on Sep 28, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



require('/includes/languages/'.$language.'/'.FILENAME_DEFAULT)

assuming FILENAME_DEFAULT is a constant then your require should be quoted as above

JonNewbie

3:29 pm on Sep 28, 2007 (gmt 0)

10+ Year Member



Hi Jatar,

Good to hear from you. I am not sure whether FILENAME_DEFAULT is a constant or not. Anyway, thanks for the tip.

Much, much, more than that, thanks for the first pointer on how to properly do the script syntax for the ('.') string operator, which has resolved the bulk of my editing work.

Best regards,
Jon Newbie