[[#wd Lookup TitleRecipe4 ]]

Overview

COAST provides the composition of page elements by HTML-Template files.

Preconditions

Steps to do:

  1. You should analyse and planning your page layout before you begin to create a COAST application.
    Find answers to the following questions:
  2. Define Renderer Specifications according to your answers above and create a HTML template file.
    e.g. SharedPageLayout.html:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"<html>"
    		"	<head>"
    		"		<title>"
    		"			[[#wd Lookup PageTitle ]]"
    		"		</title>"
    		"	</head>"
    		"	<body background= imagedir/backgrnd.gif >"
    		"		[[#wd Lookup Photo ]]"
    		"		[[#wd Lookup Text1 ]]"
    		"		[[#wd Lookup Text2 ]]"
    		"		[[#wd Lookup Footer ]]"
    		"	</body>"
    		"</html>"
    	}
    }]]
    
  3. Create a new configuration file
    e.g. Page.any and specify a tag /PageLayout for the topmost that declares a shared layout html-file.
    Content of file Page.any:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"{"
    		"	/Version "Page.any Version 1.0 1997/12/04""
    		"	/PageLayout {"
    		"		/HTML {"
    		"			/TemplateName "SharedPageLayout"    #HTML filename"
    		"		}"
    		"	}"
    		"}"
    	}
    }]]
    
  4. Afterwards you can define different renderers for the elements in Page.any.
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/Photo {"
    		"	/HTML {"
    		"		/Template {"
    		"			"[[#wd Image { /ImageName "MyPhoto.gif" } ]]""
    		"		}"
    		"	}"
    		"}"
    		" "
    		"/Text1 {"
    		"	/HTML {"
    		"		/Template {"
    		"			"<HR><center>Do you know this very famous sight on the picture above?</center>""
    		"		}"
    		"	}"
    		"}"
    		" "
    		"/Text2 {"
    		"	/HTML {"
    		"		/Template {"
    		"			"<HR><center>This picture shows the 'Matterhorn' (Switzerland).</center>""
    		"		}"
    		"	}"
    		"}"
    		" "
    		"/Footer {"
    		"	/HTML {"
    		"		/Template {"
    		"			"<HR><center>powered by COAST</center>""
    		"		}"
    		"	}"
    		"}"
    	}
    }]]
    
  5. If you specify any of the renderers again in the configuration file of a Subpage the definition of its superpage is overwritten on this page and all its subpages
    e.g. FirstPage.any:
    [[#wd DisplayAnythingRenderer {
    	/AnythingInfo {
    		"/PageTitle "Welcome on the 'National Geographic' Webpage 1""
    		" "
    		"/Photo {"
    		"	/HTML {"
    		"		/Template {"
    		"			"[[#wd Image { /ImageName "My2ndPhoto.gif" } ]]""
    		"		}"
    		"	}"
    		"}"
    		" "
    		"/Text2 {"
    		"	/HTML {"
    		"		/Template {"
    		"			"<HR><center>This picture shows the 'Big Ben' in London (Great Britian).</center>""
    		"		}"
    		"	}"
    		"}"
    	}
    }]]
    

Remarks

This example shows how you can reuse items from within your page hierarchy and that you can overwrite this items whenever you'd like to.

Glossary

Shared Page-Layout, HTML-Templates

Related Topics