Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 12:52 pm EST

Geeklog Forums

PHP include not working in staticpages


Rob

Anonymous
I have turned on php and selected the "execute php" option and it doesnt display anything, it works on a non geeklog page and i really dont want to use a tacky iframe tag, is there anything i need to do to get this to work?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
It works. You just need to make sure you're using the correct path. For a static page, the "staticpages" directory is the current path. Unless it's a centerblock, then it's the public_html directory. Use $_CONF['path'] or $_CONF['path_html'] to get the correct absolute path.

(just guessing what the problem may be since you didn't provide a lot of information)

bye, Dirk
 Quote

Rob

Anonymous
Hi Dirk,

Sorry i didnt provide much info

Basically i have got an external page which i which to integrate into my staticpage, usually i would use the HTML "iframe" tag but i have found that to become tacky looking so i researched PHP and found the "php include" tag. So i have enabled php and used the tag:

<?php include("menu.php"Wink; ?>

when i use this tag on an ordinary php page it works fine and displays the file "menu.php". BUT when i use the exact same tag in a static page it displays absolutely nothing.

If there anything in the staticpages plugin that blocks this?
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
A php-enabled static page has already the php tags, so this is enough:
Text Formatted Code
include("menu.php");

Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Adam Dube

Anonymous
it does not work either with your method, excluding the <? ?>

please help someone thanks
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Dirk's code does work, you probably just have the file in the wrong spot.

I did a quick test and if you keep the line of code the same:

Text Formatted Code
include("menu.php");


then menu.php needs to go in the following directory:

path_to_geeklog\plugins\staticpages\

Basically in the same directory as the staticpages functions.inc file since this is the file that is actually executing the php.

If you still get an error then it may be a php problem in your menu file. Try putting just a simply echo statement in the file to see if that works.

Tom
One of the Geeklog Core Developers.
 Quote

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