Thank you so much for taking the time to explain that :) I will try it over the next few days and let you know how I go!
b On Sep 25, 4:27 pm, Charlie Griefer <[email protected]> wrote: > One suggestion (among the few I imagine you'll get... use what works best > for you) > > In my views folder I have a "templates" folder that holds layout files. > These are the structure of the page. > > At first, a layout.cfm might look as simple as: > > <html> > <head> > <title></title> > </head> > <body> > > </body> > </html> > > "Views" are individual sections that comprise an overall page. MG3, out of > the gate, puts has a 'pages' folder under "views". This is where I put the > individual views. > > Let's say I have a navigation.cfm file. That would probably go into the > 'pages'. folder. > > In Model-Glue.xml, when you do an <include> inside of a <view> (inside of an > <event-handler>), that view goes into the viewCollection. > > So, my "main" event-handler might look like this: > > <event-handler name="main"> > <broadcasts /> <!-- don't worry about this for now --> > <results> > <result do="template.main" /> <!--- again, don't worry about this > for now ---> > </results> > <views> > <include name="navigation" template="/pages/navigation.cfm" /> > </views> > </event-handler> > > There's now a variable called "navigation" in the viewcollection. Let's > jump back to layout.cfm add the navigation. > > <html> > <head> > <title></title> > </head> > <body> > <cfoutput>#viewcollection.getView('navigation')#</cfoutput> > > </body> > </html> > > So, our page should (in theory) output some navigation. But how to get the > page itself to render? > > Go back to this line from the event-handler above: <result > do="template.main" /> > > That calls another event-handler in the Model-Glue.xml > > <event-handler name="template.main"> > <views> > <include name="main" template="templates/layout.cfm" /> > </views> > </event-handler> > > The first event-handler above was named "main". So now if you go > tohttp://yoursite.com/event=main(assuming "event" your eventvalue... this is > the default value and it's set in ColdSpring.xml), you should see a plain > looking page with a navigation element in it. > > So, to specifically address your question about headers and footer... > > If they're static, no reason not to put them in the layout page. If they're > dynamic, you can create individual views for them within your > <event-handler>s and call whichever header/footer file a given request > should display. > > In which case, your layout.cfm might now look like this: > > <html> > <head> > <title></title> > </head> > <body> > <cfoutput>#viewcollection.getView('header')#</cfoutput> > <cfoutput>#viewcollection.getView('navigation')#</cfoutput> > > <cfoutput>#viewcollection.getView('footer')#</cfoutput> > </body> > </html> > > Hope that made some kind of sense. Feel free to ask questions if anything > needs clarification. > > > > On Thu, Sep 24, 2009 at 10:41 PM, Brettski <[email protected]> wrote: > > > Hi, > > > Just trying to work out how to structure my "views" folder. > > > Where should I put things like headers and footers? > > > I also have a large form i've broken into several .cfm pages and > > wondering how I should store them using best practice? > > > Many thanks, > > > Brett > > -- > Charlie Grieferhttp://charlie.griefer.com/ > > I have failed as much as I have succeeded. But I love my life. I love my > wife. And I wish you my kind of success. --~--~---------~--~----~------------~-------~--~----~ Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en -~----------~----~----~----~------~----~------~--~---
