Welcome to Geeklog, Anonymous Wednesday, December 04 2024 @ 12:51 pm EST

Geeklog Forums

php in static pages


RoN

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

Text 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.
 Quote

Status: offline

ShareOurRevenue

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

Status: offline

vadertech

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

Status: offline

ShareOurRevenue

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

 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/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
Text 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
Text 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.:
Text 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.
 Quote

All times are EST. The time is now 12:51 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