PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Page comes up entirely blank when using include() (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Page comes up entirely blank when using include()


#2886
d1m1 (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Page comes up entirely blank when using include() 10 Months ago Karma: 0  
Hi, first post around here. :) I was wondering if you can help me with a problem I have with a page I'm making on Joomla! 1.5.9.

Originally it was just static content, but using your plugin I managed to reduce almost 4000 lines of code in HTML to 1480 in PHP.

Since all I did was just make functions to structure some content, I wanted to separate content from functions, so I then placed the functions and content into two files (reducing the previous 1480 lines to a little over 100; not bad), and was planning to include them using something like this:

Code:
<?php
include("/includes/PHP_MySQL/products_int_7-to-12.php");
include("/includes/PHP_MySQL/product_functions.php");?>
(This files are placed in /httpdocs/includes/PHP_MySQL). But if I do that, not even the template around the article page shows up, just a blank page. Even doing something like this:
Code:
<?php 
function testPHP()
{
  echo "<br/>This worked<br/>";
}
?>
saving this as test.php, and placing this directly in the corresponding id for the test article in jos_content:
Code:
<?php
include("/includes/PHP_MySQL/test.php");
testPHP();
?>
renders a blank page again. However, if I access a test page outside of Joomla (same server) with the same code, the page renders fine. Is there something I'm doing wrong? I could really use some help with this.
 
  The administrator has disabled public write access.

#2887
d1m1 (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Page comes up entirely blank when using include() 10 Months ago Karma: 0  
Heh, just wanted to answer my own question. After a while, it ocurred to me that most likely the blank page was supposed to be full with errors, but Joomla wasn't configured to show them.

I enabled Maximum Error Reporting in Global Configuration, under Server, and yes, 5 or 6 errors where indeed there, mostly something about "open_basedir restriction in effect". So, after Googling around a bit, I came upon this suggestion:

Instead of using something like
Code:
include("/includes/PHP_MySQL/products_int_7-to-12.php");
use something like:
Code:
include $_SERVER['DOCUMENT_ROOT'] . "/includes/PHP_MySQL/products_int_7-to-12.php";
And now it works perfectly.
 
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2009. kksou.com. All Rights Reserved