Some (static) HTML pages should be showed by a new COAST project. The pages will be linked with a next and previous button. To achieve this result the following steps are performed:
Note: This example is much more complex than the title task implies to show more relevant features of COAST. Look at other [[#wd Lookup Recipe2 ]] for simpler ways of integrating and connecting HTML files to a COAST server using simple links.
[[#wd DisplayAnythingRenderer { /AnythingInfo { "/Pages {" " /Page {" " "FirstPage" "SecondPage" "ThirdPage"" " }" "}" } }]]
[[#wd DisplayAnythingRenderer { /AnythingInfo { "{" " /Version "PageName.any Version 1.0 1997/12/04"" " /PageLayout {" " /HTML {" " /TemplateName "PageName" #HTML filename" " }" " }" "}" } }]]
[[#wd DisplayAnythingRenderer { /AnythingInfo { "#---- Renderer Specification for Next Button ---------------------" "/NextPage {" " /Form {" " /Template {" " "[[#wd Lookup NextButton ]]"" " }" " /Method "GET"" " /Action "GoNextPage"" " }" "}" " " " " "/NextButton {" " /Button {" " /Name "submit"" " /Label {" " /String {" " /Default "Next Page"" " }" " }" " }" "}" } }]]
[[#wd DisplayAnythingRenderer { /AnythingInfo { "#---- Renderer Specification for Previous Button ---------------------" "/PrevPage {" " /Form {" " /Template {" " "[[#wd Lookup PrevButton ]]"" " }" " /Method "GET"" " /Action "GoPrevPage"" " }" "}" " " "/PrevButton {" " /Button {" " /Name "submit"" " /Label {" " /String {" " /Default "Previous Page"" " }" " }" " }" "}" } }]]
[[#wd DisplayAnythingRenderer { /AnythingInfo { "<html>" " <head>" " <title>" " Welcome to the COAST" " </title>" " </head>" " <body background= imagedir/backgrnd.gif >" " <center><h1>Welcome on the second page of COAST</h1></center>" " <!-- Renderers for Next/Previous buttons specified in SecondPage.any -->" " [[#wd Lookup PrevPage ]]" " [[#wd Lookup NextPage ]]" " </body>" "</html>" } }]]
[[#wd DisplayAnythingRenderer { /AnythingInfo { "/Map {" " # the following actions are available for all pages " " /Default {" " /Home "FirstPage"" " /GoNextPage "FirstPage"" " /GoPrevPage "FirstPage"" " }" " # specific action/page maps" " /FirstPage {" " /GoNextPage "SecondPage"" " }" " /SecondPage {" " /GoPrevPage "FirstPage"" " /GoNextPage "ThirdPage"" " }" " /ThirdPage {" " /GoPrevPage "SecondPage"" " }" "}" } }]]
This example shows how you can build a COAST application from scratch in a simple way. In every Page.any file we had to insert a Renderer specification for the buttons. This disadvantage should be avoided. It's recommended to use a 'Shared Page-Layout', which allows to define layout rules only once and reuse them. The 'Shared Page-Layout' is descripted in recipes 4/5.
FormRenderer, FieldRenderer, Shared Page-Layout, HTML-Templates