SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old August 26th, 2004, 02:33 PM
Albion Albion is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 Albion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old August 26th, 2004, 02:34 PM
Albion Albion is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 Albion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old August 26th, 2004, 02:50 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
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.

Reply With Quote
  #4  
Old August 26th, 2004, 03:03 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,611 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 10 m 21 sec
Reputation Power: 53
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

Reply With Quote
  #5  
Old August 26th, 2004, 03:23 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,611 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 10 m 21 sec
Reputation Power: 53
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.

Reply With Quote
  #6  
Old August 26th, 2004, 03:28 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Page structure question.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway