We help IT Professionals succeed at work.

Creating page top & bottom logic based on folder root path

194 Views
Last Modified: 2013-12-24
Ok, I have 5 main sections (GUI) on the same domain but in one folder. Each GUI has 50 links that requires the user to input data into the forms! I just created a new section with a GUI in a DIFFERENT FOLDER with a new look.   The 5 old sections need to adopt 18 of the new sections but with a different page top and bottom and style sheet. So I need some logic to decide where the user is in the root of the folder and then decide which style sheet and header and footer to apply. I do not want to re-create 90 (18 x 5 ) pages that can all be shared. The form will remain the same but the look will change depending on which area they are in. HELP! Maybe I can do a CFINCLUDE with page top & bottom logic?
Comment
Watch Question

Author

Commented:
I need to chose between the following below::


THIS IS THE NEW page top stuff!

<head>
      <title>Survey Central</title>
      <style type="text/css" media="screen">
      @import url(value_style.css);
      </style>
            <meta name="description" content="Survey Central" />
      <link rel="Shortcut Icon" type="image/ico" href="../favicon.ico" />
</head>
<body style="margin: 0; padding: 0;">

<cfparam name="sidepic" default="home" type="string">
<cfset sidepic = 'about'>

<div id="container2">
      <div id="top"><cfinclude template="top.cfm"></div>
      <div id="leftnav"><cfinclude template="navbar.cfm"></div>
      <div id="content">

      <div id="palebox">

HERE IS WHAT THE OTHER 5 SECTIONS USE:

<cfparam name="PageType" default="click_mode">
<cfparam name="ProjectPage" default="yes">
<cfinclude template="pagetop.cfm">
Scott BennettManager Technology

Commented:
The way I usually hande this kind of site is to set it up so that there is a root folder where all the templates that make up the core functionality of the sites reside and point all the sites to that directory.

then in your application.cfm you determine which look and feel you need to use based on the domain or subdomain. The you set a variable in application.cfm called request.siteincludes based on which domain is being accessed, and that is where you store the header, footer, stylesheets, images, etc for each instance of the application. You would also set up any other instance specific variables here too like maybe configuration options for the application. I usually keep these in a database table for easy editing and have the application pull the information for all the instances from the database.

then in the code in your main folder you just do

<cfinclude template="#request.siteincludes#/header.cfm">
<!--- Common form code goes here --->
<cfinclude template="#Request.siteincludes#/footer.cfm">

That is how I did it for
http://www.eztradein.com
http://ebay.eztradein.com
http://cc.eztradein.com
http://gateway.eztradein.com
http://buy.eztradein.com
http://casio.eztradein.com
http://doublesight.eztradein.com
http://hdradio.eztradein.com
http://sharp.eztradein.com
http://toshiba.eztradein.com

And there's a lot more companies that have instances of that site but you can see each has it's own look and feel but use the same core templates using the method I described above.


Author

Commented:
Well the security is built into the page top & bottom which is different for the new one. So what I had in mind was using the code above with cfif???? within the cfinclude. This was allows me to change the file once. Does the code above make sense? I'm sorry, I'm having a hard time explaining.

Author

Commented:
Something like this maybe:::

<cfif #CGI.PATH_INFO# CONTAINS "project">
<head>
<title>Alignment During Front End Planning</title>
      <style type="text/css" media="screen">
      @import url(value_style.css);
      </style>
            <meta name="description" content="Survey Central" />
      <link rel="Shortcut Icon" type="image/ico" href="../favicon.ico" />
</head>
<body style="margin: 0; padding: 0;" onLoad="reloaddiv();">

<cfparam name="sidepic" default="home" type="string">
<cfset sidepic = 'about'>

<div id="container2">
      <div id="top"><cfinclude template="top.cfm"></div>
      <div id="leftnav"><cfinclude template="navbar.cfm"></div>
      <div id="content">

      <div id="palebox">
<cfelse>

<cfparam name="PageType" default="click_mode">
<cfparam name="ProjectPage" default="yes">
<cfinclude template="pagetop.cfm">
</cfif>
Scott BennettManager Technology

Commented:
ahh ok so this is an include that you want to act differently when it is  being included from a file in a specific folder?

Author

Commented:
YES!~ I just love you SBennet! LOL

Author

Commented:
the code that I posted isn't working thou.

Author

Commented:
I got it to work!
Manager Technology
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Ok the way I did it has to many glitches so I'm going to try it ir your way (above).
Scott BennettManager Technology

Commented:
Ok also I noticed I didn't set a value in my example, the first part should be like:

<cfset request.MyVariableName = "Something">
<cfinclude template="myinclude.cfm">

then in myinclude.cfm do something similar to what you did:
<cfparam name="request.MyVariableName" default="">
<cfif Request.MyVariableName eq "Something">
do one thing
<cfelse>
do another thing
</cfif>

Author

Commented:
I know, lol. I figured it out earlier. Thanks. I'm getting much better! Feeling great!

Author

Commented:
Problem, I created the myinclude.cfm page and I put this in the page:

<cfset request.MyVariableName=vbp>

<cfinclude template="myinclude.cfm">

I'm getting a error that says:Variable VBP is undefined.

Author

Commented:
Here's the code for mymyclude page:

<cfparam name="request.MyVariableName" default="">
<cfif Request.MyVariableName eq "vbp">
<head>
<title>Alignment During Front End Planning</title>
      <style type="text/css" media="screen">
      @import url(value_style.css);
      </style>
      <meta name="description" content="Survey Central" />
      <link rel="Shortcut Icon" type="image/ico" href="../favicon.ico" />
</head>

<cfparam name="sidepic" default="home" type="string">
<cfset sidepic = 'about'>

<div id="container2">
      <div id="top"><cfinclude template="top.cfm"></div>
      <div id="leftnav"><cfinclude template="navbar.cfm"></div>
      <div id="content">

      <div id="palebox">
<cfelse>
<cfparam name="PageType" default="Edit_mode">
<cfparam name="ProjectPage" default="yes">
<cfinclude template="pagetop.cfm">
</cfif>

Author

Commented:
sorry I jumped the gun, I got it

Author

Commented:
SBennett I'm looking for something but I don't know what it's called or if I can really explain it, but once I do I'll post a new question cna u help me figure this out please?

Its an extension for this question posted. The headers and footers are working. But I have to apply this to the action page as well and 19 more set of pages. So I want to have cfif statements around the unique variables that I set on each the page. Im going to have 19 more forms that Im going to do cfinclude but I want to do them all in one page. I removed the headers and footers from all pages so that I can just have the form itself be called because its shared from with two separate entities and looks.

For example:

On the page itself:

 <cfset request.MyVariableName="vbp_1">

<cfinclude template="/Scriptcontent/myInclude.cfm">


In the include I would have this:

<cfparam name="request.MyVariableName" default="">

<cfif Request.MyVariableName EQ "vbp_1">

<div id="container2">
      <div id="top"><cfinclude template="/Scriptcontent/value/top.cfm"></div>
      <div id="leftnav"><cfinclude template="/Scriptcontent/value/navbar.cfm"></div>
      <div id="content">
    <div id="palebox">
      <cfinclude template="/Scriptcontent/value/form_test.cfm">
      </div>
      </div>

      <div id="footer">&nbsp;</div>
</div>
</body>
</html>
      
<cfelse>
<cfparam name="PageType" default="Edit_mode">
<cfparam name="ProjectPage" default="yes">
<cfinclude template="/Scriptcontent/BMProject_central/Question/project/pagetop.cfm">
<body style="margin: 0; padding: 0;" onLoad="reloaddiv();">
<cfinclude template="/Scriptcontent/value/form_test.cfm">
<cfinclude template="/Scriptcontent/BMProject_central/Question/project/pagebottom.cfm">
</cfif>  

What I think I want to do is tie the vbp_1 with the form include that only have <cfform----</cfform> info in it only.

Like this <cfinclude template="/Scriptcontent/value/form_test.cfm"> I want to change this to <cfinclude template="/Scriptcontent/value/vbp_1.cfm"> So it would know what form to get. I think I should put it like this <cfinclude template="/Scriptcontent/value/#vbp_1#.cfm">

I can keep going from vbp_1-vbp_19. What do you suggest?

Author

Commented:
Let me add how things flow

1. The page itself vbp_fealign.cfm just have the JS & the cfinlude calling the myinclude.cfm

2. The actual myinclude.cfm page has the headers and footers selection based on the cfset variable on the vbp_fealign.cfm page

3. The the myinclude calls the guts (form) form_test.cfm. which is only code is form <cfform>---</cfform>. Each header and footer calls this include.

But I have 18 more form_test pages plus the action pages.

So, 19x2 for one header will give you the entry and action pages for design and then 19x2 for the other design. That's 76 for 1 section.

Plus I have to do for 4 more sections (304 more pages)! Woo! But once I complete this one section I'll be good.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.