Solved

Code once and reuse in Dreamweaver CS5?

Posted on 2011-02-15
3
953 Views
Last Modified: 2012-05-11
I have a static site I'm updating in Dreamweaver CS5, it's all in HTML.

The main menu is coded with a Table element, displayed on over a hundred pages.

I need to add another button to the menu, so I'm considering doing a Find and Replace in one shot.

1) Is that the safest or fastest approach?

2) Anything i can do now to setup the site so I don't have to go through this again? Perhaps a Dreamweaver template or something?
0
Comment
Question by:sandshakimi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 34899418
>> 1) Is that the safest or fastest approach?

Assuming your table code is the same on all pages, yes it is safe and reasonable fast.

>> 2) Anything i can do now to setup the site so I don't have to go through this again? Perhaps a Dreamweaver template or something?

If any element is the same on multiple pages, you should consider calling it as an include instead of straight code on all pages.  That way, the element can be updated at a single source and replicated to all target pages.  If you are using PHP or ASP for the site, then this is as simple as:

<?php include('/path/to/htmlsnippet'); ?>

If you are not using server-side scripting on your site, you would want to convert the table to a Dreamweaver Library Item and use that instead of full-blown templates.  

Templates don't work well once you have an existing site as you would have to add the template markup to all of your existing pages.  You can do it, but it is hard.
0
 
LVL 4

Expert Comment

by:IceCode
ID: 34900070
good answer, just one thing to add...  If you do a "replace all" throughout your site in Dreamweaver, there will be no going back.  I mean no "undo".  Good luck.
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 250 total points
ID: 34900552
>> If you do a "replace all" throughout your site in Dreamweaver, there will be no going back.  I mean no "undo".

Actually, there is a way to allow for it but you have to have all pages open in DW first and depending on your system speed, that can be a problem.  If you have enough horsepower, here is how to do it:

1) Open a page and the switch to code view.  We want all subsequent pages to open in code view so having a "starter" page is necessary

2) Do a Find for whatever code you will be replacing.  Do not do a replace, just Find All

3) In the results panel, highlight all results, right click, and select Open Files

4) Assuming you have enough power, all files will open in code view in the editor.

5) Now do the Find and Replace.  Because the files are open you will have the ability to Undo
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Media Queries  not Firing 6 26
href return to normal window 5 28
Debugging Html 8 31
Two decimal 5 25
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question