Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Friday, May 24 2013 @ 01:02 AM EDT


 Forum Index > Support > General Geeklog Support New Topic Post Reply
 PHP include not working in staticpages
   
Anonymous: Rob
 05/31/09 05:41PM (Read 2380 times)  



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
Dirk
 05/31/09 05:52PM  
AAAAA
Admin

Status: offline


Registered: 01/12/02
Posts: 13027
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

 
Profile Email Website
 Quote
Anonymous: Rob
 05/31/09 06:00PM  



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
beewee
 06/01/09 07:06AM  
+++++
Full Member

Status: offline


Registered: 08/05/03
Posts: 969
A php-enabled static page has already the php tags, so this is enough:
PHP Formatted Code
include("menu.php");

Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 
Profile Email Website
 Quote
Anonymous: Adam Dube
 04/19/11 08:30PM  



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

please help someone thanks

 
 Quote
Laugh
 04/20/11 08:36AM  
AAAAA
Admin

Status: offline


Registered: 09/27/05
Posts: 876
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:

PHP 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

 
Profile Email Website
 Quote
Content generated in: 1.48 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content