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:
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.
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 1Now, 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.
14
12
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.
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.
12
12
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.
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.
14
15
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
//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.
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
13
14
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