Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
sugarstudio #1
Ideas for sharing same code with 2 web sites
I'm working on a project where 2 web sites will each have a distinct look and
feel, but I'd like to have them share the same code base, rather than just
duplicating (and maintaining) two sets of .cfm files.
I can put some application variables in application.cfm to define specific
image paths, etc., but does anyone have suggestions on the best way to set up
the physical directory structure so each site has it's own application.cfm yet
still drill down into the code base?
I'll be using IIS 6.0 and will have a different domain name for each site,
e.g. [url]www.site1.com[/url] and [url]www.site2.com[/url]. I'm sure I'm missing something obvious
here....
sugarstudio Guest
-
Sharing Code Snippets with team
Does anyone know how to change the Snippets folder to a shared network folder? I've had a look in; C:\Documents and Settings\\Application... -
Remove code form all sites in one swope??
is there anyway to remove like a word or line of code from all th epages in your site, without going through them each by hand? Keep in mind, i did... -
Sharing UserControls between different sites
Hi I have some common UserControls i want to share between to sites (on the same mashine but on diffrent virtual paths). right now i have on... -
Sharing code
Hello everyone, Is there a website for sharing scripts/other custom code we have written with one another? I think that would be useful for... -
Sharing a shopping cart between 2 sites...
Hello, Just a little problem. I want to share a shopping cart between 2 php sites for example foo and fii. There'is no login / password solution... -
pflynn02 #2
Re: Ideas for sharing same code with 2 web sites
Um point both the domains to the same directory in IIS.
pflynn02 Guest
-
Neo Rye #3
Re: Ideas for sharing same code with 2 web sites
I'd start by suggesting you look into either Fusebox4 (or MachII if your more
object oriented) as a basic architectural approach. We currently have about 50
different sites running on one code base (only one root directory,
application.cfm and index.cfm for all of them) using this methodology. Even if
you don't think you need it now, it's good experience.
Then I'd load up the different site settings from a database or xml file based
on the domain name and set them to application variables and name your
application something like: <cfapplication name="#cgi.server_name#">. Then
always reference the site specific stuff like images as
application.images.directory. If you need it, you can create a website specific
directory structure like root\<website>\images or root\<website>\content.
This should get you started in the right direction.
Good Luck!
Neo Rye Guest
-
sugarstudio #4
Re: Ideas for sharing same code with 2 web sites
Neo, of course I can't find it now but I remember reading something buried in
the Macromedia docs on application.cfm /cfc that you shouldn't put <cfif>
statements in there as it's not always reliable.
I had thought about keying off the CGI variable for the domain and setting the
appropriate path variables etc. accordingly in application.cfm, but reading
this note somewhere scared me off.
Just curious if you've had experience with it working or not. Thanks for the
guidance.
sugarstudio Guest
-
Neo Rye #5
Re: Ideas for sharing same code with 2 web sites
All I have in my application.cfm file is the following code:
<cfif CompareNoCase(cgi.script_name, "/index.cfm")>
<cflocation url="http://#cgi.server_name#/index.cfm" addtoken="no">
<cfabort>
</cfif>
Neo Rye Guest
-
sugarstudio #6
Re: Ideas for sharing same code with 2 web sites
Thanks Neo -- I'll give it a try and see if it works.
sugarstudio Guest
-
MattRobertson #7
Re: Ideas for sharing same code with 2 web sites
The simplest way: Put all of your common code into a folder named... /Common/
Then create two web sites, each with its own web root. Put the UNIQUE files
for each site into this web root. If a unique page needs to access a common
file (i.e. [cfinclude template="common/myinclude.cfm"] make sure the 'common'
folder is referenced in the link as shown above.
In IIS, create a virtual directory mapping to the /Common/ folder.
You can accomplish this in about 10 seconds if you hurry, or 30 seconds if you
take your time :-).
MattRobertson Guest
-
JIP #8
Re: Ideas for sharing same code with 2 web sites
On the server...have one main domain name. Then, inside that is a folder called / sites / and / admin /. The admin folder as where you and your users can log into to manage content.
Within the sites folder is the root folders for all the domain names that share the application files.
So...
The index.cfm file sets the SITEID variable first. After that is set you can use cfinclude to retrieve the inc_settings.cfm and use the SITEID to get site settings. I store the DOMAIN NAME in the database based on the SITEID.Code:www.MainDomain.com ADMIN SITES www.asite.com pageimages sitefiles index.cfm www.anothersite.com pageimages sitefiles index.cfm www.anothersiteven.com pageimages sitefiles index.cfm Application.cfm inc_settings.cfm inc_header.cfm inc_footer.cfm
The index.cfm page consists of only a few cfincludes to call the settings, header and footer files. My application reads a url variable which is a phrase like "about-us" or "contact-page" but could be "pageid" or whatever you want. I like uses phrases for SEO purposes.
There are a few server set up things you'll have to consider. I am on Apache and create "Symbolic Links" in each directory that basically allow the sharing of the CFIDE folder between sites. I'm not sure if IIS has a similar option.JIP Guest



Reply With Quote

