Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 07:48 pm EDT

Geeklog Forums

Simple test of PHP in staticpages fails - why?


staticpages_fan

Anonymous
From what I read in the FAQ and forums, I should be able to include PHP in the HTML of a staticpage but this simple page test fails:

Parse error: syntax error, unexpected '<' in /home/myportal_systemfiles/plugins/staticpages/functions.inc(841) : eval()'d code on line 1

This is my staticpage content:
Text Formatted Code

<h1>This is a test of using php in a staticpage</h1>
<?php echo '<br>This text is from pho'; ?>
<hr>
 

I have the page option: execute php set.

Can anyone help?

:banghead:
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
If you enable PHP, the content of the static page is expected to be PHP code. <h1> is not PHP code ...

Solution:
Text Formatted Code
?><h1>This is a test of using php in a staticpage</h1>
<?php echo '<br>This text is from pho'; ?>
<hr>

Also see the documentation.

bye, Dirk
 Quote

staticpages_fan

Anonymous
Thanks - I must have missed the part of the explanation that said you need to have a closing PHP tag at the top of the page content.

Works now - thanks again!
 Quote

All times are EDT. The time is now 07:48 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