Welcome to Geeklog, Anonymous Tuesday, December 24 2024 @ 11:27 am EST

Geeklog Forums

Staticpages PHP Parse Error


Lex

Anonymous
I enabled PHP for my static pages. When I have "Execute PHP" in the pop menu for the static page, no matter what, I always get the following error when trying to view the page:

Parse error: parse error, unexpected '<' in /staticpages/index.php(59) : eval()'d code on line 1


I replaced the /staticpages/index.php with a fresh copy and still no luck.

I searched the forums for further solutions and came up empty. GL version is 1.4.0sr5-1.

Any help would be greatly appreciated!

Thanks,
Lex
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
Do you have <?PHP ... ?> surrounding your PHP block? It isn't needed.
 Quote

Lex

Anonymous
It's a combination of HTML and with some PHP includes
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
You didn't answer my specific question. staticpages with PHP use the php function eval() to render the page. The string passed to eval is evaluated as if it were php. So if you want to output HTML you have to leave php mode:
Text Formatted Code
  $a = 'more content';
  $str = "?><TABLE><TR><TD>My content</TD><TD><?PHP echo $a;?></TD></TR></TABLE>";
  echo eval($str);

The above code will output

<TABLE><TR><TD>My content</TD><TD>more content</TD></TR></TABLE>
So perhaps you need a ?> at the begining of your staticpage.
 Quote

All times are EST. The time is now 11:27 am.

  • 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