PDA

View Full Version : phtml error


comicw
12-28-2002, 01:24 PM
Hi,

I've been editing a template for my mailing list, it's in PHTML, but I keep getting this error. Does anyone of you know what the problem is?
Are there any other problems that I may have overlooked?

Thanks!

Here's the error:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/broken/public_html/mlm/subscribe.phtml on line 49


Here's the phtml code:

<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"default.css\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.womenpol.be/site/nederlands/default.css\">

<style type=text/css>

Body {scrollbar-3dlight-color : #AAAAB9; scrollbar-arrow-color : #FFB336; scrollbar-base-color : #AAAAB9;
scrollbar-darkshadow-color : #AAAAB9; scrollbar-face-color : #304459; scrollbar-highlight-color : #AAAAB9;
scrollbar-shadow-color : #52525F; scrollbar-track-color : #AAAB9; font-size: 8.5pt; font-family: "Verdana"; color: #FFFFFF}

input.btn {color: #FFB336; background-color: #304459; font-size: 8.5pt; font-family: "Verdana"; font-weight: 600}

</style>

</head>

<body bgcolor="#304459">

<?

if (file_exists("setup/setup.phtml")):

include("setup/setup.phtml");

if (file_exists("$listadmin/$list.phtml")):

include("$listadmin/$list.phtml");

if (file_exists("$header.phtml")):
include("$header.phtml");
endif;

echo "<center><br><br><br>";

function emailOK($str) {
$badChars = "[ ]+| |\+|=|[|]|{|}|`|\(|\)|,|;|:|!|<|>|%|\*|/|'|\"|~|\?|#|\\$|\\&|\\^|www[.]";
return (eregi($badChars,$str));
}

if ($enc != ""):
if (file_exists("confirm/$enc")): $optin = "off"; include("confirm/$enc"); endif;
endif;

if ( !(eregi("([a-z0-9_\.-])+@([a-z0-9_\.-])+\.([a-z0-9_\.-])+",$email)) || emailOK($email)):

echo "<P>The address <b>$email</b> you submitted is wrong.
<BR>Please check and try again.";
echo "<P><FORM><INPUT class="btn" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

else:

if (file_exists("$lists/$id.phtml")):

exec("grep $email $lists/$id.phtml",$execAr);

if ($execAr[0] != ""):

echo "<IMG SRC=\"http://www.brokenfrontier.com/images/fillinlogo1.png\" WIDTH=236 HEIGHT=110 BORDER=0><p><b>Error!</b><BR>This address has already been submitted to the list. <P><FORM><INPUT class="btn" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

else:

if ($optin == "on"):

$enc = uniqid("");

$to = "$email";
$from = "$listname <$from>";
$subject = "Sign up Confirmation";
$body = "Thanks for subscribing to $listname list.\n\nTo confirm your registration, please click on the link below :\n$url/subscribe.phtml?list=$list&enc=$enc\n\nIf you did not register, do not click on the link and you will not receive any further newsletters.";

mail($to,$subject,$body,"FROM: ".$from);

$filemessage = "<? \$email = \"$email\"; ?>";
$cartFile = fopen("confirm/$enc","w+");
fputs($cartFile,$filemessage);
fclose($cartFile);

echo "Thanks!<P>A message has been sent to <b>$email</b> to complete your registration.<BR>Please check your email and follow the instructions. <P><FORM><INPUT class="btn" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

else:

$filename = "$lists/$id.phtml";
$fd = fopen( $filename, "r" );
$contents = fread( $fd, filesize( $filename ) );
fclose( $fd );

if ($contents == ""):
$fileMessage = "$email";
else:
$fileMessage = "\n$email";
endif;

$count=0;
$maxloop=5;
$finished=0;
while ($count<$maxloop&&!$finished) {
if (file_exists("$lists/$id.phtml")):

exec ("mv -f $lists/$id.phtml $lists/$id.tmp");

$cartFile = fopen("$lists/$id.tmp","a+");
fputs($cartFile,$fileMessage);
fclose($cartFile);

exec ("mv -f $lists/$id.tmp $lists/$id.phtml");
$finished=1;

else:

sleep(1);

endif;
$count++;
}

echo "<IMG SRC=\"http://www.brokenfrontier.com/images/fillinlogo1.png\" WIDTH=236 HEIGHT=110 BORDER=0><P>Thanks!<P><b>$email</b> has been added to the mailing list.";

endif;

endif;

else:

echo "<IMG SRC=\"http://www.brokenfrontier.com/images/fillinlogo1.png\" WIDTH=236 HEIGHT=110 BORDER=0><P><b>Error!</b><BR>The newsletter to which you want to subscribe no longer exists.";

endif;
endif;

else:

echo "Sorry, your address cannot be added at the moment.<BR>Please try again later.";

endif;

else:

echo "Sorry, your address cannot be added at the moment.<BR>Please try again later.";

endif;


if (file_exists("$footer.phtml")):
include("$footer.phtml");
endif;

?>

</body>

redhead
12-28-2002, 01:53 PM
you need to backslash all the double quote marks you put in...

eg:
echo "Thanks!<P>A message has been sent to <b>$email</b> to complete your registration.<BR>Please check your email and follow the instructions. <P><FORM><INPUT class=\"btn\" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

there are at least three places you need to do that in your coding.



and you dont need to do that where its not in php... like on line 2:

<link rel=\"stylesheet\" type=\"text/css\" href=\"default.css\"><link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.womenpol.be/site/nederlands/default.css\">

should be

<link rel="stylesheet" type="text/css" href="default.css"><link rel="stylesheet" type="text/css" href="http://www.womenpol.be/site/nederlands/default.css">

krycek
12-28-2002, 01:55 PM
I believe your problem is in this line (line 47):

echo "<P><FORM><INPUT class="btn" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

Your quotes are not set up properly. Redo the line and I expect the problem (which appears on the next line) will disappear :)

e.g.

echo "<P><FORM><INPUT class=\"btn\" TYPE=\"BUTTON\" VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

Hope that helps! :)

::] krycek [::

comicw
12-28-2002, 03:52 PM
Thanks! Now it works just fine.

A few questions though:
- the link rel .... blablablabla was part of the template --> do I still need that in the code for my site (and for my mailing list to work properly)?
- can I incorporate any more HTML in the page and just put the PHP code where I want it to appear on the page?

Nightfire
12-29-2002, 08:25 AM
Off-topic, but you might want to use the .php extension. phtml is now depreciated and not used in the latest version(s) of php

brothercake
12-29-2002, 04:37 PM
Originally posted by Nightfire
Off-topic, but you might want to use the .php extension. phtml is now depreciated and not used in the latest version(s) of php

I use it all the time, although it is usually necessary to add a custom handler for it. I find it useful to remind me that ".phtml" files are essentially static HTML with php in them, where ".php" files are almost or entirely dynamic. Just a personal convention.