Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

some example Code, how supertemplates can be used.

allo67c486a023c0
diff --git a/htroot/Lab.html b/htroot/Lab.html
index 1e50d4906..860c12d14 100644
--- a/htroot/Lab.html
+++ b/htroot/Lab.html
@@ -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>
@@ -17,8 +8,4 @@ You may try out these things but please do not care about bugs.</p>
<ul>
<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>
+</ul>
\ No newline at end of file
diff --git a/htroot/env/page.html b/htroot/env/page.html
index 6292a3945..9586e35df 100644
--- a/htroot/env/page.html
+++ b/htroot/env/page.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)#
\ No newline at end of file
+
+#%env/templates/footer.template%#
+</body>
+</html>
diff --git a/htroot/env/page.java b/htroot/env/page.java
index f7ad0f8a8..9394be31e 100644
--- a/htroot/env/page.java
+++ b/htroot/env/page.java
@@ -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;
}
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index 39fb94568..ae470a435 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -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());