|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Page structure question.
I've only been programming in ColdFusion now for about 6 months and I was wondering if the way I structure my pages was good or crap.
index.cfm Code:
<TABLE border=0 height=100% width=100% cellpadding=5 >
<TR>
<TD colspan=3 valign="top" height=75 >
<CFINCLUDE template="header.cfm">
</TD>
</TR>
<TR>
<TD rowspan=2 width=20% valign="top" >
<CFINCLUDE template="sidemenu.cfm">
</TD>
<TD width=60% height=100% valign="top">
<TABLE WIDTH=100% height=100%>
<TR>
<TD height=80% valign="top">
<CFOUTPUT>
<CFINCLUDE template="#Variables.Load_Page#">
</CFOUTPUT>
</TD>
</TR>
<TR>
<TD height=3%>
</TD>
</TR>
<TR>
<TD valign="bottom" height=17%>
<CFINCLUDE template="footer.cfm">
</TD>
</TR>
</TABLE>
</TD>
<TD rowspan=2 width=20% valign="top" >
<CFINCLUDE template="links.cfm">
</TD>
</TR>
</TABLE>
From any template in my page I can call "index.cfm?Load_Page=file.cfm" and it will include that template inside of the body. The only problem I have is that a lot of information is displayed in the address bar of the browser. Is there a better way to do this or is this a common way of designing ColdFusion web pages? Thanks for the input. -Craig |
|
#2
|
|||
|
|||
|
Oh, I forgot to mention at the top of my page I convery URL.Load_Page and FORM.Load_Page to Variables.Load_Page.
-Craig |
|
#3
|
||||
|
||||
|
I used to do the ?page=somePage thing, but I don't like the way it looks, some search engines don't like it, and it sort of invites curious types to "explore".
Now my pages look like this: <cfinclude template="_header.cfm"> ...Content... <cfinclude template="_footer.cfm"> Inside _header.cfm I usually have an instance of _nav.cfm. I prepend these special file names with "_" to help group them together in the folder for easy reference. |
|
#4
|
|||
|
|||
|
I use the Fusebox 4 and Mach-II frameworks, which support the concept of "content component variables". Basically you can run a specific bit of code (say to generate a nav bar) and then capture that output inside a variable (using <cfsavecontent> but the frameworks do that for you). Now you've got a variable holding your nav bar which you can place anywhere you want to. You do the same thing with main page content, sidebars, etc. Then at the end you have a final layout which takes the various content components and lays them out as needed. This approach is incredibly flexible and allows you to alter the layout of your pages very easily, or even allow users to choose different "skins" which simply use different final layout pages to spit out the content components.
I also get fancy if necessary and create layoutManager CFCs (using the Singleton pattern and placing them in the application scope) that handle the logic of generating the layouts if the logic is complex. But even then the idea of content component variables is still used, the CFC just has more robust logic to decide what content components to generate and where to place them. Hope that helps.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#5
|
|||
|
|||
|
Also, I'd be really carefull using something like this:
index.cfm?Load_Page=file.cfm as wdn2000 mentioned, it's too easy for people to start throwing other page names in there to see what happens. But as long as you are careful or aren't worried about people snooping around (not sensitive data), then you are probably ok. |
|
#6
|
||||
|
||||
|
One place I did some work for a few years back used:
index.jsp?id=1 Each page had an id number so you didn't even have to really guess the page names! Not a good idea.Oh, and they had "sensitive" content too. wdn2k |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Page structure question. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|