HiveBrain v1.2.0
Get Started
← Back to all entries
patternhtmlMinor

Structuring a master page

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
masterstructuringpage

Problem

I have a small Coldfusion section of our site that all uses similar JavaScript and CSS files and page design. The code is currently repeated for each file, and I'd like to factor it out and set something up using a master page and templates.

Master.cfm page:


    
        
        #title#
        ... all script and css links here ...
        
        
        ... etc ...
    
    
        
            
                Back
                #title#
                Home
            
            
                
            
        
    


Then a page example would be something like this. CustomerSearch.cfm:


    title = "Customer Search";
    pageName = "_customer-search";
    include "Master.cfm";


And then I would need a _customer-search.cfm page that would include all the body content for the page.

This means that I would need 2 files for every page that we currently have - the outer page that defines the variable and includes the master page, and the template page that has the individual page content.

Is this a good logical design? Is there anyway to improve it?

Solution

My ColdFusion is a little rusty, but why would you not have the setting of the master dependent variables and the call to the master page both contained within the same page? Other than that, sure, you're implementing this the same way everyone does unless it's specifically built into the language.

Context

StackExchange Code Review Q#44841, answer score: 2

Revisions (0)

No revisions yet.