GlowHost Web Hosting Forums  

Go Back   GlowHost Web Hosting Forums > In The Lounge > Programming Talk
Register Forum FAQ Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-27-2005
No longer a Newbie
 
Join Date: Apr 2005
Location: Los Angeles Metro
Posts: 5
Rep Power: 0
rickpugh is on a distinguished road
Talking Referencing a PHP Class inside a PHP Include

Hi everyone,

Thought that this would be a good place to see if any of you could help "educate" me on some of the more "creative" tricks with PHP.

Here is the situation...

I am setting up a full PHP Image Gallery. This gallery uses a MySQL Database and has a php front end. It is very nice. I am really doing this little effort to teach myself more about PHP and MySQL. I already have a working Gallery that I really like for my site so this is really just an educational effort on my part.

I have hit a snag:

The Gallery runs on four different PHP Class Files. They are:

1. MySQLHandler.class.php
2. Photogallery.class.php
3. ImageHandler.class.php
4. BBCodes.class.php

Each of these classes performs pretty much as named. Each of these classes are included into the main PHP code by being required in the "header.include.php" file that is at the top of every page:

Here is what the header code looks like:

PHP Code:
require('./MySQLHandler.class.php');
require(
'./SZPhotoGallery.class.php');
require(
'./ImageHandler.class.php');
require(
'./SZBBCodes.class.php');
$MySQLHandler = new MySQLHandler();
$MySQLHandler->init();
$ImageHandler = new ImageHandler($MySQLHandler);
$SZBBCodes = new SZBBCodes();
$SZPhotoGallery = new SZPhotoGallery($MySQLHandler$ImageHandler$SZBBCodes);
$page = isset($_GET['page']) ? $_GET['page'] : false;
$photo_category_id = isset($_GET['photo_category_id']) ? $_GET['photo_category_id'] : false
Here is where I am having the problem. I don't know how to refer to the location of the class files in the above code. I have tried using document root, local path, and http location but have had no luck.

I did a little research on the PHP web site and saw some posting in the comments section from various people that they have had the same problem. Unfortunately, no one has posted any type of solution.

Here are the errors that I am getting:

*************************
Please note that the paths that are specified in this error message have been changed. I provide accurate path/file locations below.
*************************

Code:
Warning: main(): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/ricknlis/public_html/rick/new/spm/ebay/images/inc/header.inc.php on line 2
 
Warning: main(): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/ricknlis/public_html/rick/new/spm/ebay/images/inc/header.inc.php on line 2
 
Fatal error: main(): Failed opening required 'http://rick.ricknlisa.com/new/spm/ebay/images/inc/MySQLHandler.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ricknlis/public_html/rick/new/spm/ebay/images/inc/header.inc.php on line 2
To make any type of comments or replies easier, here is some more info:

1. The class files are located in "public_html/rick/ebay/images/"
2. The php image gallery files are located in "public_html/rick/ebay/images/"
3. The include file that references the class files above is located in "public_html/rick/ebay/images/inc/"

So here is what I am looking to find out:

1. In the code situation above, what type of directory path should be specified?

2. Should I change from sing quote ( ' ) to double quote ( " ) for different types of path formats?

3. In PHP, what does ( ./ ) represent? Is it the same as ../ in unix?

Thanks everyone in advance!

Rick

Last edited by Matt; 10-20-2007 at 01:37 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-22-2006
jmarcv's Avatar
immoderate moderator
 
Join Date: Jan 2005
Posts: 297
Rep Power: 67
jmarcv is just really nicejmarcv is just really nicejmarcv is just really nicejmarcv is just really nicejmarcv is just really nice
Default

Same here, I can help you out if you still need it. Sorry I didn't catch this last spring <g>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:11 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO
Copyright 2000-2007 GlowHost.com