6 Replies Latest reply on Jun 29, 2015 9:43 AM by Carl Von Stetten

    Page Template like Dreamweaver???


      (New to eclipse switching over from Dreamweaver)


      I am building a project that requires some "core" code in every file. With Dreamweaver I was able to save a file as a template and call it everytime I needed to create a new page.  Is there a way to do that in CF Builder?

        • 1. Re: Page Template like Dreamweaver???

          I think you can create your code as "snippets" and then after creating a blank page, pull the "snippet" into it. It looks like the Eclipse engine requires this extra step.


          As a side note, if you are building a project that requires some "core" code in every file, could I suggest you look at http://www.fusebox.org which is an easy to learn, very very accessible, framework for coding ColdFusion (and other languages), and I've found personally very helpful over the years in moving from "core code in every file" to a manageable, flexible, and fun approach to coding.

          • 2. Re: Page Template like Dreamweaver???
            RamKulkarni Level 2

            You can set the initial CFM/CFC content for new pages in Preferences->ColdFusion->Editor Profiles->Editor. Check 'New File Settings' section.

            • 3. Re: Page Template like Dreamweaver???
              Jose Galdamez

              The options discussed here will definitely work assuming you don't need to make too many sitewide updates to the boilerplate code. For example, if you decide to change some code in your boilerplate, then any files created previously created are now out of sync. Personally, I've gotten around this by relying on custom tags.


              http://www.coldfusioncookbook.com/entry/142/How-can-I-easily-control-the-look-and-feel-of- my-site?


              I know in Dreamweaver, if you create a template and you update the template, Dreamweaver gives the option to push the changes to all child pages when the template is modified. It's highly doubtful you will get such a feature in Eclipse, at least not without an extra plug-in of some sort


              You could, in theory, do mass Find/Replace across the site using CF Builder. I remember being able to do this using Eclipse/CFEclipse with results almost as good as Dreamweaver's mass replace engine. I can't figure out how to do it in CF Builder though. Best I could do was go to Search->Search and then click on "Replace", but I'm not really sure what that does. If you could get this to work, this approach may be a viable workaround for such a scenario.

              • 4. Re: Page Template like Dreamweaver???
                Adam Cameron. Level 5

                You should only ever use DW templates if you're maintaining a static HTML site: DW templates are a work-around for the fact that HTML doesn't have a concept of factoring oft-used code out into separate files.


                In a CF-driven site, you should have the code in a separate CFML file, and then include that file from any other template that needs to call that code.  You should not be using DW templates to fudge this.




                • 5. Re: Page Template like Dreamweaver???
                  Dave Miller

                  I have also extensively used Dreamweaver templates in my projects. Now that DWCC no longer supports ColdFusion development, I am looking for an alternative. Was wondering if CF Builder supports DW Templates. Apparently not. My point of view is that using DW templates is not fudging. It is a very useful way of building a project.


                  Breaking up a format into a lot of different CF files seems real kludgey to me. I've seen it done and inserting code into editable areas with the DW templates seem far more maintainable.


                  Any news on what you ended up doing?

                  • 6. Re: Page Template like Dreamweaver???
                    Carl Von Stetten Adobe Community Professional & MVP



                    What you refer to as "kludgey" would probably be referred to as proper "MVC" application design. As applications grow over time, MVC makes maintenance and improvements much more streamlined.


                    At the very least, you should consider putting "boilerplate" code into a separate CFM file and using <cfinclude> to load that code into any page where it is needed. Putting the same exact code into multiple files is a "code smell".


                    -Carl V.