Posted on: 02/05/05 08:37pm
By: Anonymous (RoN)
Hi,
When I try to run php on a static page, I get the message:
Parse error: parse error, unexpected '<' in /home/revenue/public_html/staticpages/index.php(59) : eval()'d code on line 1
Now, I guess it's the html tags doing this, can't you use html and php together?
Please forgive me, I'm a self taught fool.
php in static pages
Posted on: 02/05/05 08:57pm
By: ShareOurRevenue
Sorry, that was my post above. I've searched the forum and didn't find an answer.
I've read the documentation, but according to that, html and php can be combined.
Some reason, I won't work for me. I have it set to execute php, and I've tried the other option as well.
Well, I've narrowed it down. If I START with php, it works. The problem is, I want to start with HTML, and have the php at the bottom.
php in static pages
Posted on: 02/05/05 09:34pm
By: vadertech
are you using
<? ?>
tags? If so, try it without them.
php in static pages
Posted on: 02/05/05 10:17pm
By: ShareOurRevenue
No, I'm not using the tags.
The only way I got it to work was putting it at the top withe JUST the opening php tag.
It wont work when I put it at the bottom, after the html. I've tried every variation I can think of, with and without the tags, just the opening tag, just the closing tag.
And while I'm asking, I'm trying to put my rdf feed in a block, but for some reason, it's not being saved in the RSS feed field. When I go back to edit, it's not there.
php in static pages
Posted on: 02/06/05 01:33am
By: machinari
pretend this code block is the staticpages' editor text box.
It is design to take PHP input if PHP is enabled. This means that a PHP open tag is assumed and so is not necessary
e.g.: set to execute
//begin PHP script without open tag
echo "hello world";
echo "<p>this is an HTML paragraph being outputted from within PHP.</p>';
//close PHP script without closing tag
e.g.: set to return
//begin PHP script without open tag
$retval = "<p>";
$retval .= "this is an HTML paragraph being outputted from within PHP.";
$retval .= "</p>";
return $retval;
//close PHP without closing tag
You see, if you enable PHP on your static pages then the code must be PHP. Your other choice is to use open and close tags, but you must start with the close tag in order to "get out" of PHP mode, so to speak.
e.g.:
//end PHP
?>
<p>this is an HTML paragraph</p>
<?php
//this ends my HTML section and now I can write PHP
hope that helps.