Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-05-29 11:35:47
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Parse error: syntax error, unexpected $end in...
could anybody help me with this php code?
the error page itself
the first three lines of code:
<txp:php>
if ($send !== 'send') {
</txp:php>
dumb in php
Offline
Re: Parse error: syntax error, unexpected $end in...
Gallex wrote:
could anybody help me with this php code?
It’s probably not your PHP. If that’s in an article it’ll probably be because Textile is trying to parse it. Wrap your code like this:
notextile.. <txp:php>
if ($send !== 'send') {
</txp:php>
or start it with a couple of spaces or turn off textile processing in the article or…
EDIT: if it’s not in an article then it is your PHP, as maniqui says :-)
Last edited by Bloke (2009-05-29 12:27:07)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#3 2009-05-29 12:08:10
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
it’s in a form not in an article
Offline
Re: Parse error: syntax error, unexpected $end in...
Hi Gallex,
and all the other lines? That chunk of PHP ends is incomplete (it ends on {, so it’s missing at least one }, and that’s probably related to your issue.
Offline
#5 2009-05-29 12:29:12
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
the whole code.:
<txp:php>
if ($send !== 'send') {
</txp:php>
<----skipped html------>
<txp:php>
} else {
/* subject */
$subject = "Broneering veebilehelt";
/* message */
$message = 'Broneering tehti eesti keeles<br><br>
Nimi - '.$eesnimi.' '.$perenimi.'<br>
E-mail - '.$email.'<br>
Telefon - '.$telefon.'<br>
Faks - '.$faks.'<br><br>
Aadress - '.$aadress.'<br>
Linn - '.$linn.'<br>
Riik - '.$riik.'<br>
Soovib saada - '.$tuba.'<br>
Saabub - '.$saabumine.', kell '.$saabumine_kell.'<br>
Lahkub - '.$lahkumine.'<br>
Inimesi - '.$inimesi.'<br>
Hommikusöök - '.$hommikueine.'<br><br>
Maksmine - '.$maksmine.'<br><br>
Tagasisidet soovib - <br>
<blockquote>
Telefonitsi: '.$telefoni_teel.'<br>
E-mailiga: '.$emaili_teel.'<br>
Faksiga: '.$faksi_teel.'<br>
</blockquote>
Lisainfo - '.$lisainfo.'<br>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
/* additional headers */
$headers .= "From: ".$eesnimi." ".$perenimi." <".$email.">\n";
/* and now mail it */
mail('margusson@gmail.com', $subject, $message, $headers);
// mail('tari@cafe.ee', $subject, $message, $headers);
echo 'Täname Teid. Broneering on vastu võetud.';
}
</txp:php>
Offline
Re: Parse error: syntax error, unexpected $end in...
Did you try?
<txp:php>
if ($send !== 'send') {
<---- html------>
} else {
,,,
</txp:php>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Parse error: syntax error, unexpected $end in...
Ahaaa, colak is right then. You can’t split PHP with XHTML in textpattern.
Last edited by Bloke (2009-05-29 12:46:11)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#8 2009-05-29 13:02:55
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
colak wrote:
Did you try?
<txp:php>
if ($send !== 'send') {
<---- html------>
} else {
,,,
</txp:php>
now yes.
Offline
Re: Parse error: syntax error, unexpected $end in...
Gallex
Sorry, you can’t put XHTML directly inside PHP either without ‘escaping it’. You can either do it with echo statements or, perhaps easier, like this:
<txp:php>
if ($send !== 'send') {
echo <<<EOHTML
<---- html goes here------>
EOHTML;
} else {
// your other stuff
}
</txp:php>
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#10 2009-05-29 13:22:10
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
jebii! thank’s guys
Offline
#11 2009-05-31 10:30:49
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
hmm…but code itself somehow not working… :(
could the terrible validation cause the problem?
the page
any ideas?
my final code righ now:
<txp:php>
if ($send !== 'send') {
echo <<<EOHTML
<form action="" method="post" onsubmit="return validate(this);">
...<---some more form html code here----->...
<INPUT id="reset" type="reset" value="Tühjenda väljad!" name="reset">
<input type="hidden" name="send" value="send">
</form>
EOHTML;
} else {
/* subject */
$subject = "Broneering veebilehelt";
/* message */
$message = 'Broneering tehti eesti keeles<br><br>
Nimi - '.$eesnimi.' '.$perenimi.'<br>
E-mail - '.$email.'<br>
Telefon - '.$telefon.'<br>
Faks - '.$faks.'<br><br>
Aadress - '.$aadress.'<br>
Linn - '.$linn.'<br>
Riik - '.$riik.'<br>
Soovib saada - '.$tuba.'<br>
Saabub - '.$saabumine.', kell '.$saabumine_kell.'<br>
Lahkub - '.$lahkumine.'<br>
Inimesi - '.$inimesi.'<br>
Hommikusöök - '.$hommikueine.'<br><br>
Maksmine - '.$maksmine.'<br><br>
Tagasisidet soovib - <br>
<blockquote>
Telefonitsi: '.$telefoni_teel.'<br>
E-mailiga: '.$emaili_teel.'<br>
Faksiga: '.$faksi_teel.'<br>
</blockquote>
Lisainfo - '.$lisainfo.'<br>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
/* additional headers */
$headers .= "From: ".$eesnimi." ".$perenimi." <".$email.">\n";
/* and now mail it */
mail('margusson@gmail.com', $subject, $message, $headers);
// mail('tari@cafe.ee', $subject, $message, $headers);
echo 'Täname Teid. Broneering on vastu võetud.';
}
</txp:php>
Last edited by Gallex (2009-05-31 11:36:26)
Offline
#12 2009-06-05 09:08:49
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
tested this whole code with rah_test_php plugin and got the error:
Parse error: syntax error, unexpected ‘<’ in /www/apache/domains/www.aleksandri.ee/htdocs/textpattern/publish/taghandlers.php(3082) : eval()’d code on line 1
i get it nothing anymore…
Offline
Re: Parse error: syntax error, unexpected $end in...
Why won’t you use ZCR
Gallex wrote:
hmm…but code itself somehow not working… :(
Where do you get all those variables including $send, $eesnimi and so on? Those variables won’t work if you don’t set them to hold some data before using. In your case, for example, you have to set post data to the variables.
If that is your whole code, it is only going to return a one $error (_undefined variable $send) and the form. Nothing more. It doesn’t work as it is. You need to define the variables.
It would be adviced to actually clear the input data from Javascript and all other sorts of hacks that could do harm.
tested this whole code with rah_test_php plugin and got the error:
rah_test_php just parses the PHP and returns answer. Read: it’s no debugger, neither you can use it as an interface usage instructor. It is used to, for example, to decode strings, string transforms, array manipulations and so on. Also note that you don’t use <txp:php> nor <?php in it’s input.
Last edited by Gocom (2009-06-05 11:23:08)
Offline
#14 2009-06-05 12:08:25
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: Parse error: syntax error, unexpected $end in...
Gocom wrote:
Why won’t you use ZCR
actually i’m using ;) and everything works well
except one thing: client needs sender name instead of sender email address to appear in from field in email header. zcr could not provide this :( i already asked it here
Offline