473,385 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Globally included file

markrawlingson
346 Expert 100+
Hi guys/gals,

I was wondering if there is a way to globally include files throughout all scripts within PHP. This is possible in ASP within the Global.ASA file but through my research I've found that PHP does not have an equivalent to the Global.ASA. I read something about this being possible by editing some parameter in a file called .htaccess but there was no explanation on how to do this.

The reason for wanting to do this is because I have a file which includes all my application level functions - I can include this page on all my pages by using include() at the top, but I'd rather have it included in one central location so that if i switch servers or the directory structure changes, or any other unforseen change happens, I don't have to change the reference to the file in thousands of places. I hate being stuck in scenarios where if I have to or want to change something I have to edit hundreds of files to accomplish the task.

Thanks for your help.

Sincerely,
Mark
Nov 2 '07 #1
1 1193
Atli
5,058 Expert 4TB
Hi Mark.

A simple solution would be to create one file that includes all other files and reference only the one file in each of your other files. Then if you need to add or change files you want included everywhere you would simply have to edit that one file.

You may also want to look into the set_include_path() function. I've never tried that so I don't know exactly how it works, but I think it can help you here.
Nov 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Bob | last post by:
I've tried everything; and I can't seem to get past this VERY (seemingly) simply problem. I want to work with an array variable within a function(s). I can't get it to work; if I: 1) global...
13
by: Jean-François Doyon | last post by:
Hello, I'm using MetaClasses to create classes. How do I make these new classes "globally" available? I probably just have to assign them to something magic, but I can't seem to figure out...
2
by: chand | last post by:
Hi., In my api.py file 'g_opt_list' is defined globally g_opt_list =,,,,,,] when I run the py file, I am getting the Following Error SyntaxWarning: name 'g_opt_list' is used prior to global...
9
by: userblue | last post by:
Hi Does anyone know if there is a way to define what is effectively a single globally visible, enumerated list whilst actually defining the entries across several different modules? or somehow do...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.