This page shows a complete example and its result. It illustrates :
- How to manage multiple languages (2 languages: fr and en)
- How to locate pages in different directories (here, one
directory per page)
- How to create a menu without the link on the current page
- An example of how to split page form and page content
This example is divided into two files:
- the file lib.wspp describes the way pages look
- the file main.wspp describes the content of the pages
Six web pages are generated, each with a menu and a link to the
second language.
Note: The generated HTML code may be viewed by right-clicking and
selecting "View Page Source"
Click here to display the web site resulting from the command 'webSitePP.py main.wspp'
Source du fichier main.wspp
<DEFINELANG fr />
<DEFINELANG en />
<INCLUDE lib.wspp />
<DEFINE TEST_MACRO>
<p>
<L fr> Ceci est le texte de la macro de test </L>
<L en> This is the text of the test macro </L>
</p>
</DEFINE>
<PAGE DirA/MyPage1>
<PAGE_STRUCTURE>
<PARAM> <L fr> Ma page 1 </L>
<L en> My page 1 </L> </PARAM>
<PARAM> #DDEEFF </PARAM>
<PARAM>
<L fr>
<p>
Ceci est le texte français de la page 1.
On peut y placer du <b>HTML</b> ou appeler des macros.
</p>
</L>
<L en>
<p>
This is the English text of page 1.
You can put <b>HTML</b> or call some macros.
</p>
</L>
<TEST_MACRO>
</PARAM>
</PAGE>
<PAGE DirB/MyPage2>
<PAGE_STRUCTURE>
<PARAM> <L fr> Ma page 2 </L>
<L en> My page 2 </L> </PARAM>
<PARAM> #EEFFDD </PARAM>
<PARAM>
<L fr> <p>Ceci est le texte français de la page 2.</p></L>
<L en> <p>This is the English text of page 2.</p></L>
</PARAM>
</PAGE>
<PAGE DirC/MyPage3>
<PAGE_STRUCTURE>
<PARAM> <L fr> Ma page 3 </L>
<L en> My page 3 </L> </PARAM>
<PARAM> #FFDDEE </PARAM>
<PARAM>
<L fr><p>Ceci est le texte français de la page 3.</p></L>
<L en><p>This is the English text of page 3.</p></L>
</PARAM>
</PAGE>
Source du fichier lib.wspp
<DEFINE CURRENT_ITEM_COLOR #FF0000 />
<DEFINE MENU_ITEM>
<IF NEQUAL SELF_PAGENAME USEPARAM0 >
<a href=" <PAGEFILENAME USEPARAM0 SELF /> " >
<ELSE/>
<font color=" <CURRENT_ITEM_COLOR/> ">
</IF>
<li> <p> <USEPARAM 1 /> </p> </li>
<IF NEQUAL SELF_PAGENAME USEPARAM0>
</a >
<ELSE/>
</font>
</IF>
</DEFINE>
<DEFINE MENU>
<br><br><br><br>
<ul>
<MENU_ITEM>
<PARAM> DirA/MyPage1 </PARAM>
<PARAM> <L fr> Cliquer pour voir ma page 1 </L>
<L en> Click and see my page 1 </L>
</PARAM>
<MENU_ITEM>
<PARAM> DirB/MyPage2 </PARAM>
<PARAM> <L fr> Cliquer pour voir ma page 2 </L>
<L en> Click and see my page 2 </L>
</PARAM>
<MENU_ITEM>
<PARAM> DirC/MyPage3 </PARAM>
<PARAM> <L fr> Cliquer pour voir ma page 3 </L>
<L en> Click and see my page 3 </L>
</PARAM>
</ul>
<br>
<L fr><a href="<PAGEFILENAME SELF en>"> English version </a></L>
<L en><a href="<PAGEFILENAME SELF fr>"> Version française </a></L>
</DEFINE>
<DEFINE PAGE_STRUCTURE>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<meta name="description" content=" <USEPARAM 0> " />
<title>
<USEPARAM 0>
</title>
</head>
<body>
<br><br>
<table width="100%">
<tr>
<td align="left" nowrap="nowrap"
width="30%" rowspan="2">
<MENU>
</td>
<td align="center" valign="top" height="20%">
<h1> <USEPARAM 0> </h1>
</td>
</tr>
<tr>
<td align="center" bgcolor=" <USEPARAM 1> ">
<USEPARAM 2>
</td>
</tr>
<br><br>
</body>
</html>
</DEFINE>
|