Forum Moderators: coopster

Message Too Old, No Replies

OOP page = Blank

cannot display page

         

henry0

7:35 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OOP – page does not display

I need your keen eyes to figure out what is happening here

I have an OOP script that works well on two local test servers
One runs a slightly older PHP, the other one the last PHP just before release of PHP5, in both cases it runs with Reg Glob off, as it should
How is it built:
One) A class that reads a template, sets values, and sends info to a browser.
That class I have used many times and I know it does not cause any trouble

Two) a templates
Using the following
<!--{PROD_1}--> no problems here!

Three) the main page
<<
require_once ("../DB conn etc..."); // Include the configuration file.
require_once ("../classes/the class I mentioned in “One”.class"); // Include the class.
$id=1;
$page = again the “One” class ("../templates/main_template_products.inc.php"); // Create an instance.
$content_1 .= '';
include "../includes/prod_1.inc.php";
$page->SetParameter("PROD_1", $content_1);

and my include file
<?
$conn = db_connect();

$sql= "select prod_1 from XXXXX where id=$id";
$result = mysql_query($sql,$conn);

while ($new_content=mysql_fetch_array($result) ){
$content_1.= $new_content[prod_1];
}
?>

I am pretty sure that the scripts has no fault
It works on another production server

So what can go wrong
Up to the point of getting a full blank page that in “view source” shows 100% of nothing!
I know the DB conn fine since I can edit it via my CMS using the same db conn function

Will that be a server setting?
It runs with reg glob on and safe mode on

dreamcatcher

8:32 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are there any errors in the actual class or classes that are being called? Try accessing your class files directly in your browser to see if any parse errors show.

henry0

9:23 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks
I already tried that, I used my classes before
so no error
if I call directly the templates it shows fine its formating and a few lines of text that are not pulled from the DB

regards
Henry

henry0

12:17 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AS you may imagine safe mode on or off does not impact
so what's going on?
thanks
Henry

coopster

5:49 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you absolutely sure that you are connecting and running a successful query? Have you tried a simple script on the server in question with just that portion of your code?

henry0

6:12 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes I did
thanks Coopster
but I ran the script on another host and had no problems
my script works regardless of safe mode or register global set up

I used it before and the db conn works fine

I am really thinking that it has to do with server setup
but which area?
Henry

coopster

6:15 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That's what I'm getting at though -- did you test a simple db connection on the problem server and make sure you were indeed getting a connection?

henry0

7:39 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK I see where you coming from
sorry I got it the other way around!

and the answer is NO
but please be with me, exactly at the same root level
I have my authentication, admin, and update, del etc.. cms system that use the same DB connection classes
and works OK

Last news:
the host asked me to try instead of ../connect script to use /pub/user/.... path to my connection files
and THEN IT WORKS
I am glad it does but why in that OOP environment
and only on that server there is such a requirement
knowing that on another server it works fine

the answer is that I start to run too many sites
and timing to consider a dedicated server seems perfect.
Great I will face more problems!

again thank you

Henry

coopster

8:29 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The best advice I could give you at this point is to control the
include_path
. That way you can just include() your files, and never have to worry about the path. You'll set it once when you setup a new site and be done with it. A lot of programmers use this technique, you'll often see it called the "config.php" script or something similar. I've added a sample to the latest Bag o' Tricks [webmasterworld.com] thread.

henry0

8:38 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is perfect
Ending before it starts a future headache

Cheers

Henry