Prev Next

An Example Linking To Other Pages In The Same Web Site

cref
The cross reference command cref is used to link to another destination in the same web site. If the requested destination does not exist, a warning is printed on stdout .

Execute The Following Steps

cref_example_1.omh
Use an editor of your choice to create the file cref_example_1.omh in the test directory with the following contents:
     
$begin
cref_example_1$$
     $spell
     	Cref
     $$
     
     $section Parent Section For Cross Referencing Examples$$
     
     $head First Argument$$
     The first argument to a cref command is the text
     that the user sees for the link.
     This is also the default value for the cross reference tag of the
     section that we are linking to.
     Each section starts with a begin command
     that contains its cross reference tag as an argument.
     The cross reference tag for this section is cref_example_1.
     The cross reference tags for the children of this section are
     $cref _contents$$,
     $cref cref_example_2$$,
     $cref Cref3Example$$,
     $cref _reference$$,
     $cref _index$$, or
     $cref _search$$.
     Note that the sections corresponding to
     _contents,
     _reference,
     _index,
     and _search,
     are automatically generated.
     
     $contents/
     	cref_example_2.omh/$$
     
     $end
Note that you can copy and paste the commands above to your editor window. You may just copy the file with the same name from the getting started directory .

cref_example_2.omh
Use an editor of your choice to create the file cref_example_2.omh in the test directory with the following contents:
     
$begin
cref_example_2$$
     $spell
     	cref
     $$
     
     $section An Example Specifying the Cross Reference Tag$$
     
     If there is more than one argument to a cref command,
     the second argument specifies the cross reference tag.
     For example, if you select the following link:
     $cref/parent of this section/cref_example_1/$$.
     
     $end
     ----------------------------------------------------------------------
     $begin Cref3Example$$
     $spell
     	cref
     	omhelp
     $$
     
     $section An Example Specifying a Heading $$
     
     The third argument to a cref command specifies the heading
     for the cross reference.
     For example, if you select the following link:
     $cref/first argument/cref_example_1/First Argument/$$.
     
     $end
     ----------------------------------------------------------------------


Example In This Web Site Context
You can view the result of making cref_example_1.omh part of the OMhelp help web site by selecting cref_example_1 .

Execute OMhelp
In a command window and in the htm directory execute the following command
 
     omhelp ../cref_example_1.omh -noframe

Example by Itself
Use a web browser of your choosing to view the file test/htm/cref_example_1.htm .
Input File: getstarted/start_cref.omh