PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 15th, 2008, 06:19 AM
roundelld roundelld is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 3 roundelld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 52 sec
Reputation Power: 0
Parse errors - Parse error: parse error, unexpected T_STRING

am getting the following error on line 10

Parse error: parse error, unexpected T_STRING in C:\Inetpub\wwwroot\pub\speller\spellchecker.php on line 10

for:

Code:
<?php 
header('Content-type: text/html; charset=utf-8');

$spellercss = "C:\Inetpub\wwwroot\pub\speller\spellerStyle.css";
$word_win_src = "C:\Inetpub\wwwroot\pub\speller\wordWindow.js";
$textinputs = $_POST['textinputs']; # array
$aspell_prog = "C:\Program Files\Aspell\bin\aspell.exe";
$aspell_opts = "-a --encoding=utf-8";
$tempfiledir = ".\";
$input_separator = "A";


the last line is line 10 and as you can see there's more than plenty of the ';' - so where am i going wrong?

this is to install aspell - a spell checker on a wiki at work using windows

thanks for any help!

david

Reply With Quote
  #2  
Old June 16th, 2008, 01:37 AM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 552 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 33 sec
Reputation Power: 14
unexpected string token

Hi roundelld, welcome to the forums,
I wonder if the <?php tag isn't being considered as a "line"? What does your line 11 look like?
__________________
WP plugins - Error Reporting, Clean Options
http://www.mittineague.com/dev/er.php
http://www.mittineague.com/dev/co.php

Reply With Quote
  #3  
Old June 16th, 2008, 07:31 AM
roundelld roundelld is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 3 roundelld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 52 sec
Reputation Power: 0
thanks for the reply

an extract of the next few lines of script are copied below:

Code:
# set the JavaScript variable to the submitted text.
# textinputs is an array, each element corresponding to the (url-encoded)
# value of the text control submitted for spell-checking
function print_textinputs_var() {
	global $textinputs;
	foreach( $textinputs as $key=>$val ) {
		# $val = str_replace( "'", "%27", $val );
		echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n";
	}
}


which i have not changed.

Reply With Quote
  #4  
Old June 23rd, 2008, 09:59 PM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 552 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 33 sec
Reputation Power: 14
unexpected string

I downloaded spellchecker.php, the beginning of which is
PHP Code:
<?php
header
('Content-type: text/html; charset=utf-8');

$spellercss '/speller/spellerStyle.css';
$word_win_src '/speller/wordWindow.js';
$textinputs $_POST['textinputs']; # array
$aspell_prog 'aspell';
$lang 'en_US';
$aspell_opts "-a --lang=$lang --encoding=utf-8";
$tempfiledir "./";
$input_separator "A";

# set the JavaScript variable to the submitted text.
# textinputs is an array, each element corresponding to the (url-encoded)
# value of the text control submitted for spell-checking
function print_textinputs_var() {
    global 
$textinputs;
    foreach( 
$textinputs as $key=>$val ) {
        
# $val = str_replace( "'", "%27", $val );
        
echo "textinputs[$key] = decodeURIComponent(\"" $val "\");\n";
    }
}
Notice in the $tempfiledir you changed the forward-slash to a back-slash. A back-slash indicates an "escaped" character. So PHP considers the following double-quote as a literal double-quote and not a string delimiter. Try escaping the slash. i.e.
PHP Code:
 $tempfiledir ".\\"

Reply With Quote
  #5  
Old June 24th, 2008, 04:26 PM
roundelld roundelld is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 3 roundelld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 52 sec
Reputation Power: 0
thanks!

Quote:
Originally Posted by Mittineague
I downloaded spellchecker.php, the beginning of which is
PHP Code:
<?php
header
('Content-type: text/html; charset=utf-8');

$spellercss '/speller/spellerStyle.css';
$word_win_src '/speller/wordWindow.js';
$textinputs $_POST['textinputs']; # array
$aspell_prog 'aspell';
$lang 'en_US';
$aspell_opts "-a --lang=$lang --encoding=utf-8";
$tempfiledir "./";
$input_separator "A";

# set the JavaScript variable to the submitted text.
# textinputs is an array, each element corresponding to the (url-encoded)
# value of the text control submitted for spell-checking
function print_textinputs_var() {
    global 
$textinputs;
    foreach( 
$textinputs as $key=>$val ) {
        
# $val = str_replace( "'", "%27", $val );
        
echo "textinputs[$key] = decodeURIComponent(\"" $val "\");\n";
    }
}
Notice in the $tempfiledir you changed the forward-slash to a back-slash. A back-slash indicates an "escaped" character. So PHP considers the following double-quote as a literal double-quote and not a string delimiter. Try escaping the slash. i.e.

PHP Code:
 $tempfiledir ".\\"



thanks for that. yes the back slash was causing the error as you mentioned above but i also had to give permissions for cmd.exe (which spellchecker can be run under on the server) for it to work.

as it happens it's installed and working fine but having to put all the I.T related words and business specific terms in manually. that's a real killer!!

thanks again for pointing me in the right direction. cheers!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Parse errors - Parse error: parse error, unexpected T_STRING


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap