In the process of developing and building a website, we may encounter a situation where when a considerable part of our website has been completed, we find that some details still need to be modified. At this time, it is impossible to make changes completely by hand, so what should we do? Using the search and replace in Dreamwaver can help realize these modifications.
Dreamwaver's search and replace function is very powerful, and you can even use precise "query language" to control the search process in its find and replace dialog box. The shortcut key to bring up the "Find Dialog" in Dreamwaver is "Ctrl+H". The function of each input box is: the top "Find" item is used to indicate the search range. There are 3 options. The first item It is to search within the current file, the second item is to search in the current Site, and the third item is to search in the specified folder. If we select this item, we need to click the folder-like button on the right to specify the folder; the following The "Find" item is used to select the type of search. If "Text" is selected, it means that the search type is text (non-HTML code). The other items are search in HTML code, advanced text search, and search containing Tag; on the right Enter the content to be found in the input box; "Replace" below refers to what content is to be replaced.
Let's give an example to illustrate how to use the find function. Suppose we want to replace "dreamwaver" in the body text with "Dreamwaver". If we only use "Text" to search, "dreamwaver" in <title> will also be replaced. We don't want this. So we used "Advanced Text Search" and set the search conditions (the content to the right of the "+" and "-" buttons) to "Inside Tag" and "Font", which means to find the text "dreamwaver" within the Font tag. Then replace it with "Dreamwaver". One thing that needs to be explained is that the search level option must be selected as "Match Case", that is, the search conditions must be exactly matched, otherwise the case difference in the text will be ignored.
After setting, click "Replace All" and the search and replacement process will begin. After the replacement is completed, all replaced places will be displayed in the replacement information list. The small green dot in front of the file indicates that the replacement is successful.
So how to implement search and replacement that contains Tags? Assume that all the images in our website have the "alt" attribute set (only the background image and some supplementary angle images do not set this attribute), but because we did not pay attention to setting the image when making the web page The "Border" attribute value is "0". Some pictures have borders when browsing, which affects the browsing effect. Therefore, the "Border" value of all pictures with an "alt" value must be set to "0", and in the picture In many cases, it is impossible for us to change them one by one. In this case, if we use Dreamwaver's tag search and replace function, we can easily solve the problem.
We first select the folder, and then set the folder contained in the img tag to have the "alt" attribute and match "alt=any value" as the search condition, and then set the "Action" to "Set Attribute", "Border", " 0", the meaning of this setting is to uniformly set the "Border" attribute of the images that meet the conditions to "0", and click the "Replace All" button. Soon, the search and replace is completed, and the image properties will be modified accurately.
It should be reminded that when performing search and replacement, the file being operated should not be in an edited state, otherwise replacement errors may occur.