Text Workbench Online Help Submit feedback on this topic   

HOWTO: Insert A File Reference Regarding Directory Hierarchy

To insert a reference to a file regarding the directory structure, do the following.

The Problem

You have to add a reference to a CSS file style.css stored in the folder C:\MyWeb\HTML  to all your HTML pages, stored in different folders starting from C:\MyWeb\HTML.

The Solution

  1. Specify the folder in which you want to find files. For example: C:\MyWeb\HTML
  2. Set mask(s) of the files that you want to find. For example: *.htm*
  3. We will insert a LINK tag right after the HEAD tag. So, we shall provide the following pattern in the Find What field:

    \<HEAD\>
  4. Provide the replacement expression:

    \0\r\n<LINK REL=stylesheet 
           href=\"\ph:"c:\\myweb\\html\\style.css"\" TYPE="text/css">
    
    where
        \0               is the found text (<HEAD>);
    
        \Ph:"C:\\MyW..." executes the path resolve operator,
                         telling to use the HTML mode (h letter)   
    
  5. Make sure the option Search only is unchecked.
  6. Click the Replace button.

The Result

This will insert the following text in HTML files in, say,  C:\MyWeb\HTML\Catalog:

<LINK REL=stylesheet href="../style.css" TYPE="text/css">

and the following text in HTML files in C:\MyWeb\HTML\Catalog\dir1\dir2:

<LINK REL=stylesheet href=&../style.css" TYPE="text/css">

Note!
Root parts of path names of both a referenced and processed file must be the same. It means that they must have a common drive letter.