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 completely rely on manual changes. What should I do? Using search and replace in Dreamwaver can help achieve 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 Tags; 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 replace containing Tag? Assume that all the images in our website have the "alt" attribute set (only the background image and some supplementary angle images do not have this attribute set), but because we did not pay attention to setting the "Border" attribute value of the image to "0" when making the web page, 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". When there are many pictures, it is impossible for us to cover them one by one. If you want to change it, if you use Dreamwaver's search and replace function that includes Tag, you 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.