some example Code, how supertemplates can be used.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2304 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent 5214f571cd
commit 67c486a023

@ -1,12 +1,3 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>YaCy '#[clientname]#': Lab</title>
#%env/templates/metas.template%#
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
#%env/templates/header.template%#
<br><br>
<h2>The YACY Lab</h2>
<p>
@ -18,7 +9,3 @@ You may try out these things but please do not care about bugs.</p>
<li>The <a href="Wiki.html">Wiki</a></li>
<li>Advanced <a href="/Config_p.html">Configuration</a></li>
</ul>
#%env/templates/footer.template%#
</body>
</html>

@ -1,3 +1,18 @@
#[test1]#
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>YaCy '#[clientname]#': #[title]#</title>
<!-- TODO: title cannot be set, yet. -->
<!-- clientname needs to be set in page.java (this will remove the code in httpdFileHandler,
if we use supertemplates for everything -->
#%env/templates/metas.template%#
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
#%env/templates/header.template%#
<br><br>
#[page]#
#(test2)#zero::one::two#(/test2)#
#%env/templates/footer.template%#
</body>
</html>

@ -33,8 +33,9 @@ public class page {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
//plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
prop.put("test1", "testit!");
prop.put("test2", 1);
//prop.put("test1", "testit!");
//prop.put("test2", 1);
return prop;
}

@ -693,10 +693,17 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
}
//use the page template
if(sb.getConfig("usePageTemplate", "false").equals("true")){
String supertemplate="";
if(tp.containsKey("SUPERTEMPLATE")){
supertemplate=(String) tp.get("SUPERTEMPLATE");
}
//if(sb.getConfig("usePageTemplate", "false").equals("true")){
if(!supertemplate.equals("")){
o = new serverByteBuffer();
File pageFile=getOverlayedFile("/env/page.html");
File pageClass=getOverlayedClass("/env/page.html");
/*File pageFile=getOverlayedFile("/env/page.html");
File pageClass=getOverlayedClass("/env/page.html");*/
File pageFile=getOverlayedFile(supertemplate);
File pageClass=getOverlayedClass(supertemplate);
if(pageFile != null && pageFile.exists()){
//warning: o,tp and fis are reused
httpTemplate.writeTemplate(fis, o, tp, "-UNRESOLVED_PATTERN-".getBytes());

Loading…
Cancel
Save