F Putting farcy into a template
Templates are stored under the webskin directory and under the different object types. In this example we will be using a dmHtml content type. The template we will modify is the displayPageStandard.cfm. The first stage in this process is to include the header and the footer. My displayPageStandard.cfm. looks like this at this stage.
<!--- @@displayname: Standard Page ---> <!--- @@author: code:GAVIN STEWART (gavin@daemon.com.au) styles:Peter Ottery (pottery@daemon.com.au)---> <cfsetting enablecfoutputonly="yes"> <cfimport taglib="/farcry/farcry_core/tags/container" prefix="con"> <cfimport taglib="/farcry/farcry_core/tags/webskin" prefix="skin"> <cfmodule template="/farcry/#application.applicationname#/webskin/includes/daemonHeader.cfm" pagetitle="#stObj.title#"> <cfoutput> <h1>Conent goes here</h1> </cfoutput> <!--- include standard Sidebar, we have to pass through the object structure cause it is needed in the sidebar---> <cfmodule template="/farcry/#application.applicationname#/webskin/includes/standardSidebar.cfm" object="#stObj#"> <cfmodule template="/farcry/#application.applicationname#/webskin/includes/daemonFooter.cfm"> <cfsetting enablecfoutputonly="no">
Figure 4.1
Lets test if things are working. Log into farcry and assign the home page content item a template of "Standard Page" and test to see if the home page is now rendering the header and footer and displaying "Content goes here" in big letters. NOTE: You may need to refresh the application scope to see your template as an option. One way to do this is to add updateapp=1 to the url parameters. If the page doesn't look write check the following:
- Check to see if coldfusion has thrown an error by appending &debug=1 to end of the URL. If there is an error then debug accordingly
- Make sure the header and footer files are in the correct location i.e. the includes directory under the webskin directory
- Recheck all your output tags. You might want to remove all white space control to make sure you are getting the page and implement again once the problem has been found
The next stage is to copy and paste some mark-up from a html page into the content area. My displayPageStandard.cfm now looks like this
<!--- @@displayname: Standard Page ---> <!--- @@author: code:GAVIN STEWART (gavin@daemon.com.au) styles:Peter Ottery (pottery@daemon.com.au)---> <cfsetting enablecfoutputonly="yes"> <cfimport taglib="/farcry/farcry_core/tags/container" prefix="con"> <cfimport taglib="/farcry/farcry_core/tags/webskin" prefix="skin"> <cfmodule template="/farcry/#application.applicationname#/webskin/includes/daemonHeader.cfm" pagetitle="#stObj.title#"> <cfoutput> <div id="main"> <h1><span>End to end online solutions</span></h1> <p>Daemon has extensive experience in all aspects of technical web application development utilising the Macromedia range of server and development products. Our professional services team has extensive experience across ColdFusion, Flash MX, Flash Remoting, Flash Communications Server, Java, XML, Linux, Windows and Unix systems, SQL and Oracle databases. <span class="linkset-moreinfo"><strong>More information:</strong> <a href="devtodo">Web Development</a> | <a href="devtodo">Design</a> | <a href="devtodo">Content Management</a></span> </p> <h2><span>Outsource training & services</span></h2> <p>This combination of skills means that whether you are updating an existing web-based business application to take advantage of the latest products and technologies, or are planning a completely new project, Daemon can provide the professional guidance, technical expertise and real-world experience you are looking for. <span class="linkset-moreinfo"><strong>More information:</strong> <a href="devtodo">Website support</a> | <a href="devtodo">Training</a> | <a href="devtodo">Products</a></span> </p> <hr /> <h2><span>All Services:</span></h2> <ul class="splitlist"> <li><a href="devtodo">Website Development</a></li> <li><a href="devtodo">Content Management</a></li> <li><a href="devtodo">Case Studies</a></li> <li><a href="devtodo">Custom Development</a></li> <li><a href="devtodo">Code Reviews</a></li> <li><a href="devtodo">Usability Reviews</a></li> </ul> <ul class="splitlist"> <li><a href="devtodo">Graphic Design</a></li> <li><a href="devtodo">Information Architecture</a></li> <li><a href="devtodo">Database Development</a></li> <li><a href="devtodo">E-Commerce Solutions</a></li> <li><a href="devtodo">Flash Development</a></li> <li><a href="devtodo">Game Design</a></li> </ul> <br class="clear" /> <hr /> <h2><span><a href="devtodo">Recent Daemon News</a></span></h2> <h4 class="date">January 26TH 2005</h4> <p> Daemon's application development services are underpinned by best-practice coding standards and formal production methodologies to ensure the effective delivery of complex, <a href="devtodo">read more</a> </p> <h4 class="date">December 16TH 2004</h4> <p> Daemon's application development services are underpinned by best-practice coding standards and formal production methodologies to ensure the effective delivery of complex, <a href="devtodo">read more</a> </p> </div> </cfoutput> <!--- include standard Sidebar, we have to pass through the object structure cause it is needed in the sidebar---> <cfmodule template="/farcry/#application.applicationname#/webskin/includes/standardSidebar.cfm" object="#stObj#"> <cfmodule template="/farcry/#application.applicationname#/webskin/includes/daemonFooter.cfm"> <cfsetting enablecfoutputonly="no">