Date: 09/15/00
- Next message: Martin A. Marques: "[phplib] php errors with inclution"
- Previous message: Davor Cengija: "Re: [phplib] Clearing form variables"
- In reply to: Rex Byrns: "[phplib] Using sqlguery.inc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 14 Sep 2000, Rex Byrns wrote:
>I don't know if this is a bug or not but I finally broke down and decided to
>play with this class so I used the example from the documentation. It
>worked great, but when I went to any other page that uses authentication or
>sessions, it said that sql_query was not a class. (of course these other
>pages were not including the file). Does this mean that if whatever you
>want to include, you have to include everywhere or you get errors?
If I understand you correctly, you want to have some
functionality from an .inc file in many scripts. If so, then
yes, you have to include that file (actually require()) in
every script you want the functions that .inc file provides.
Another approach is to set auto_prepend_file option in
phpX.ini, apache/httpd.conf or .htaccess. See the
documentation about this. Here's an short example:
## -- httpd.conf
<Directory "/home/httpd/html/midiken">
php3_include_path "/home/httpd/html/midiken/phplib"
php3_auto_prepend_file "/home/httpd/html/midiken/phplib/prepend.php3"
</Directory>
And finally:
## -- /home/httpd/html/midiken/phplib/prepend.php3
<?php
/* $Id: prepend.php3,v 1.2 2000/02/23 11:17:32 davor Exp $ */
if (!is_array($_PHPLIB)) {
# Aren't we nice? We are prepending this everywhere
# we require or include something so you can fake
# include_path when hosted at provider that sucks.
$_PHPLIB["libdir"] = "";
}
require($_PHPLIB["libdir"] . "db_mysql.inc"); /* Change this to match your database. */
require($_PHPLIB["libdir"] . "ct_sql.inc"); /* Change this to match your data storage container */
require($_PHPLIB["libdir"] . "session.inc"); /* Required for everything below. */
require($_PHPLIB["libdir"] . "auth.inc"); /* Disable this, if you are not using authentication. */
require($_PHPLIB["libdir"] . "perm.inc"); /* Disable this, if you are not using permission checks. */
require($_PHPLIB["libdir"] . "user.inc"); /* Disable this, if you are not using per-user variables. */
/* Additional require statements go below this line */
require($_PHPLIB["libdir"] . "oohforms.inc"); /* Object Oriented Forms */
require($_PHPLIB["libdir"] . "common.inc"); /* Some useful commands */
/* Additional require statements go before this line */
require($_PHPLIB["libdir"] . "midiken.inc"); /* Required, contains your local configuration. */
require($_PHPLIB["libdir"] . "page.inc"); /* Required, contains the page management functions. */
/* extended classes */
?>
-- Davor Cengija davor <email protected> http://www.croart.com--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Martin A. Marques: "[phplib] php errors with inclution"
- Previous message: Davor Cengija: "Re: [phplib] Clearing form variables"
- In reply to: Rex Byrns: "[phplib] Using sqlguery.inc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

