Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

includes across sub domains

0 views
Skip to first unread message

WebLurker

unread,
Jan 27, 2005, 10:46:25 PM1/27/05
to
I have a site www.mysite.com.
I have 3 subdomains sub1.mysite.com, sub2.mysite.com and
sub3.mysite.com.
sub3.mysite.com is password protected.
All pages end with .php (ie index.php)
I use the following code:

<?php
include("inc23.inc");
?>

I find that I will require some of the same includes in more than one
subdomain.
Can I do the following?

1) Create a subdomain called resources.mysit.com with 3 folders - images,
includes and stylesheets
and use

A.

<?php
include("resources.mysit.com/includes/ inc23.inc");
?>

B.

<link rel="stylesheet" type="text/css"
href="resources.mysit.com/stylesheets/stylesheetraw.css" />
Instead of
<link rel="stylesheet" type="text/css" href="stylesheetraw.css" />

C.

In my style sheet use

#toparea {background-image: url(resources.mysit.com/images/images/gs1.gif);
etc
instead of
#toparea {background-image: url(images/gs1.gif); etc

D

Does the fact that one of my subdomains is password protected complicate
anything?

Thank you


anima

unread,
Jan 28, 2005, 12:14:25 AM1/28/05
to
the include() set of functions require a local-filesystem path. To get
around the same problem as you I have a config file that holds the full
path to my public_html folder (parent of subdomains as they are just
folders there too.) and include this path and then the relative path to
the subdomain's script.

For example...

/home/domains/blah.com/public_html/ .. is my fullpath right ? you can
find yours out by looking on your phpinfo.php page it should be on
there somewhere towards the bottom.

so I store this path in a variable and can call it like so...

$fullPath . "subdomain1/config/another.php"

which will work from any of your subdomains because at the end of the
day they're all on the same filesystem.

Hope this helps,
-Dan Morris

0 new messages