TinyPortal

Development => Support => Topic started by: clothahump on November 15, 2009, 10:06:49 AM

Title: Parse error: syntax error, unexpected '<'
Post by: clothahump on November 15, 2009, 10:06:49 AM
Tried adding a php page using the following code and got error

Parse error: syntax error, unexpected '<'  in /home/tropical/public_html/Themes/default/TPortal.template.php(586) : eval()'d code on line 1

<form action="http://www.tropicalfishforums.co.uk/files/ammoniaCalculator.php" method="post">
<table class="tborder">
<tbody><tr class="tcat">
<th colspan="2" align="center">Ammonia Strength Calculator</th>
</tr>

<tr>
<th align="right">Ammonia Strength:</th>
<td><input name="ammoniaStrength" class="bginput" size="2" value="9" type="text">%</td>
</tr>
<tr>
<th align="right">Volume of Tank:</th>
<td><input name="tankVolume" class="bginput" size="5" value="100" type="text">Litres</td>
</tr>
<tr>
<th align="right">Required ppm:</th>
<td><input name="ppmRequired" class="bginput" size="2" value="3" type="text"></td>
</tr>
<tr>
<th align="right">Existing ppm:</th>
<td><input name="ppmExisting" class="bginput" size="2" value="0" type="text"></td>
</tr>
<tr>
<th align="right"></th>
<td><input name="submitButton" class="button" value="Calculate" type="submit"></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr class="tcat">
<th colspan="2" align="center">
Please enter Ammonia Strength, tank size and required ppm above. </th>

</tr>
<tr>
<td colspan="2">
<b>N.B.
<ul>
<li>To be used as a guide only</li>
<li>Assumes 0ppm Ammonia as a starting point</li>
<li>Always double check your calculation elsewhere</li>
<li>No liability will be held for incorrect input/output</li>
</ul>
</b>
</td>
</tr>
</tbody></table>
</form>
Title: Re: Parse error: syntax error, unexpected '<'
Post by: Freddy on November 15, 2009, 10:41:14 AM
That's because it's not PHP code...

That needs to go in an HTML article as that is what it is.
Title: Re: Parse error: syntax error, unexpected '<'
Post by: clothahump on November 15, 2009, 10:57:00 AM
Thanks Freddy, changed it to HTML and it now works but result opens in new page with no TP wrapper, any way to fix it?
Title: Re: Parse error: syntax error, unexpected '<'
Post by: Freddy on November 15, 2009, 11:09:29 AM
Yeah, it looks like your ammoniaCalculator.php is an external file so it will do - it's not going to know it's part of TP by itself.

I have to go out now but what you could do is try transferring the content of ammoniaCalculator.php into A TP PHP article, then change your form so it points to that page instead, something like this depending on the path to your forum, my guess is :

<form action="http://www.tropicalfishforums.co.uk/forum/index.php?page=45" method="post">

Where '45' is the page on TP - so whatever that is replace it and amend the path to point to wherever your forum is located.

I'm assuming the ammonia page doesn't call on other files and is just some simple PHP.
Title: Re: Parse error: syntax error, unexpected '<'
Post by: clothahump on November 15, 2009, 11:47:39 AM
The so called PHP file is actually a mix of PHP and HTML, I am unable to get it working so will try and find an alternative that does work.
Title: Re: Parse error: syntax error, unexpected '<'
Post by: G6Cad on November 15, 2009, 12:39:41 PM
Why not use SSI and call in the PHP file
Title: Re: Parse error: syntax error, unexpected '<'
Post by: clothahump on November 15, 2009, 02:11:14 PM
How do I do that?
Title: Re: Parse error: syntax error, unexpected '<'
Post by: G6Cad on November 15, 2009, 02:16:36 PM
Please use the search ;)

http://docs.simplemachines.org/index.php?topic=400
Title: Re: Parse error: syntax error, unexpected '<'
Post by: IchBin on November 16, 2009, 04:33:12 AM
I think you have misunderstood what this person is asking G6. You can't use SSI to include a file.

I would suggest you try another solution as you suggested, or just try including the file with the include() statement in a php article.

include('path/to/file.php');
Title: Re: Parse error: syntax error, unexpected '<'
Post by: clothahump on November 16, 2009, 08:31:55 AM
Tried the include but I get the original error, I will have to get it re-written.
Title: Re: Parse error: syntax error, unexpected '<'
Post by: Lesmond on November 16, 2009, 01:56:59 PM
Been looking at this, seems to me just put the code on its own page and call it within a iFrame in the article, I will try it out on our test site and get back asap

Edit. have a look at this: (http://www.tinyportal.net/index.php?page=11)  that is in an Iframe

<center><iframe name="I1" src="http://www.tropicalfishforums.co.uk/files/ammoniaCalculator.php" width="457" height="384" align="middle" border="0" frameborder="0">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe></center>
Title: Re: Parse error: syntax error, unexpected '<'
Post by: clothahump on November 16, 2009, 02:51:09 PM
Many thanks Lesmond, work a treat.
Title: Re: Parse error: syntax error, unexpected '<'
Post by: Lesmond on November 16, 2009, 03:01:04 PM
Your welcome, glad it worked :up: