Welcome to Geeklog Sunday, May 19 2019 @ 06:22 pm EDT

Geeklog Forums

php in static pages


RoN

Anonymous
Hi,
When I try to run php on a static page, I get the message:

PHP Formatted Code
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.

Status: offline

ShareOurRevenue

Forum User
Newbie
Registered: 25/12/04
Posts: 4
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.

Status: offline

vadertech

Forum User
Full Member
Registered: 26/05/03
Posts: 329
are you using
PHP Formatted Code
<?  ?>
 
tags? If so, try it without them.
GeekLog Hosting, Installations and Upgrades - WWW.AWEHOST.COM - Hosting starts @ only $4.95/mo.

Status: offline

ShareOurRevenue

Forum User
Newbie
Registered: 25/12/04
Posts: 4
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.


Status: offline

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
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
PHP Formatted Code

//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
PHP Formatted Code

//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.:
PHP Formatted Code

//end PHP
?>
<p>this is an HTML paragraph</p>
<?php
//this ends my HTML section and now I can write PHP


 
hope that helps.

All times are EDT. The time is now 06:22 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content