Ok, so this may be an odd question but I am just not sure about this.

I have a customer who has multiple sites with the same content on some pages. We are trying to figure out if there is a way using some type of include file if we can have the multiple sites pull from a central group of data files (could be text or whatever is needed).

Working with UNIX and traditional html but could to go windows/.net if needed.

Any ideas or suggestions? Is this even possible?

Thank you for your input.
Dewayne

Member Avatar for ingeva

Ok, so this may be an odd question but I am just not sure about this.
I have a customer who has multiple sites with the same content on some pages. We are trying to figure out if there is a way using some type of include file if we can have the multiple sites pull from a central group of data files (could be text or whatever is needed).
Working with UNIX and traditional html but could to go windows/.net if needed.
Any ideas or suggestions? Is this even possible?

I have done this for a long time. Recently I've come up with a more secure solution: I have one index file which is common for all my sites (except those made with Joomla!). Also, this index file defines the default include directory so all sites can use the same one without even knowing its location.
The index file handles existing and non-existing files (like a 404 error handler) and directories for all the domains on the host and finds the "real" location for the domain or subdomain. This way I don't have to declare subdomains in Cpanel; all I do is to create a directory for them. This is not necessarily possible in all hosts.

My index.php file looks like this:

<?php
require ".common/.php/.phplib.php";
require MAINFILE;					// Now go to site.
?>

Naturally, MAINFILE is the "real" index file (found by .phplib). All headers and declaractions are done so all that's needed is to end the </head> section (unless there's more to be added) and start <body>.

.phplib.php contains all the start code and some often used functions, and defines a whole lot of constants and variables for ease of site programming.
The rest of the php include files are in the same directory, which is set in php's include PATH. There are also directories for the CSS and JavaScript files, and there's really no limit to how many common directories you can declare.

I have zero knowledge of MS .NET but I don't expect it to be very different, except MS AFAIK doesn't have a .htaccess file so it may not be possible to configure the same way.

This didn't have much to do with html or CSS, but please excuse me this time ... :)

ingeva -

Ok, I have excused you for not sticking with htm or css. Not even sure it's possible with those! : )

Your solution is very creative and woud work with some changes for us! Thank you so much for sharing your knowledge!

Dewayne

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.