-
Advanced PHP Include Question
I have a virtual server (same ip address) with many domains on it.
I also have a few standard php files; Functions, Header, Footer, ect. that I use on many of these sites!
The question is; Is there some way to include the common files from a central location, instead of have to duplicate them for each domain.
It really would speed things up if I did not have to upgrade the same file under each domain, when changes are made to any of the common files!
Thanks...
Any ideas appreciated!
-
-
if they are all on the same server, you can include them by the path. for example just doing C:\Program Files\apache\htdocs\header.php instead of header.php
-
-
They don't even need to be on the same server. Include works with remote files too (if enabled; some security setups dissalow this).
However, only local scripts will work with the script (parse the code of the included file as if it were in the PHP file itself, continuing variable names and such.). If you are OK with just the standard output of the included file, then you can have it on a remote server just fine.
If you do need it to relate to the script, then I would suggest using GET variables, like this:
include('http://myother.com/page.php?var1=4');
And in the page.php,
$var1 = $_GET['var1']; //now==4
I hope this helps.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks