Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (103 sloc) 4.79 KB
<html lift:content_id="main">
<head>
<title>Lift Example</title>
</head>
<body>
<div id="main" class="lift:surround?with=default;at=content">
<style>
/* <![CDATA[ */
p + p {
margin-top: 0em;
text-indent: 0em;
}
.dpp_stuff p {
padding-left: 15px;
}
/* ]]> */
</style>
<p>
Lift supports surrounding a given section of a page with a template
from another file. This allows you to have master page templates
or even section templates that are accessed by many different pages.
</p>
<p>
<style type="text/css">
/* <![CDATA[ */
.function-name {
/* font-lock-function-name-face */
color: #0000ff;
}
.sgml-namespace {
/* sgml-namespace */
color: #da70d6;
}
.string {
/* font-lock-string-face */
color: #bc8f8f;
}
.variable-name {
/* font-lock-variable-name-face */
color: #b8860b;
}
/* ]]> */
</style>
<pre>
&lt;<span class="sgml-namespace">lift</span>:<span class="function-name">surround</span> <span class="variable-name">with</span>=<span class="string">"default"</span> <span class="variable-name">at</span>=<span class="string">"content"</span>&gt;
This is a simple page surrounded by the default template.
&lt;/<span class="sgml-namespace">lift</span>:<span class="function-name">surround</span>&gt;
</pre>
</p>
<p>Using the &lt;lift:surround&gt; tag, you can surround the body with
the contents of another template. The "with" attribute designates the
name of the template. By convension, templates are stored in the
/templates-hidden directory. Lift will not serve direct HTTP request
from any directory that contains "-hidden". The "at" attribute specifies
where the content should be placed in the loaded template. Lift will
look for a &lt;lift:bind name=&quot;...&quot;/&gt; tag in the target
template and insert the body of the surround tag at the bind point.
</p>
<style type="text/css">
/* <![CDATA[
.function-name {
/* font-lock-function-name-face */
color: #0000ff;
}
.sgml-namespace {
/* sgml-namespace */
color: #da70d6;
}
.string {
/* font-lock-string-face */
color: #bc8f8f;
}
.variable-name {
/* font-lock-variable-name-face */
color: #b8860b;
}
/* ]]> */
</style>
<pre>
&lt;<span class="function-name">html</span> <span class="variable-name">xmlns</span>=<span class="string">"http://www.w3.org/1999/xhtml"</span> <span class="sgml-namespace">xmlns</span>:<span class="variable-name">lift</span>='http://liftweb.net'&gt;
&lt;<span class="function-name">head</span>&gt;
&lt;<span class="function-name">title</span>&gt;Lift Web Framework: &lt;<span class="sgml-namespace">lift</span>:<span class="function-name">Menu.title</span> /&gt;&lt;/<span class="function-name">title</span>&gt;
&lt;<span class="sgml-namespace">lift</span>:<span class="function-name">CSS.blueprint</span> /&gt;
&lt;<span class="sgml-namespace">lift</span>:<span class="function-name">CSS.fancyType</span> /&gt;
&lt;<span class="function-name">script</span> <span class="variable-name">id</span>=<span class="string">"jquery"</span> <span class="variable-name">src</span>=<span class="string">"/classpath/jquery.js"</span> <span class="variable-name">type</span>=<span class="string">"text/javascript"</span>/&gt;
&lt;<span class="function-name">script</span> <span class="variable-name">id</span>=<span class="string">"json"</span> <span class="variable-name">src</span>=<span class="string">"/classpath/json.js"</span> <span class="variable-name">type</span>=<span class="string">"text/javascript"</span>/&gt;
&lt;/<span class="function-name">head</span>&gt;
&lt;<span class="function-name">body</span>&gt;
&lt;<span class="function-name">div</span> <span class="variable-name">class</span>=<span class="string">"menu"</span>&gt;
&lt;<span class="sgml-namespace">lift</span>:<span class="function-name">menu.builder</span>/&gt;
&lt;/<span class="function-name">div</span>&gt;
&lt;<span class="function-name">div</span> <span class="variable-name">class</span>=<span class="string">"messages"</span>&gt;
&lt;<span class="sgml-namespace">lift</span>:<span class="function-name">Msgs</span> /&gt;
&lt;/<span class="function-name">div</span>&gt;
&lt;<span class="function-name">div</span> <span class="variable-name">class</span>=<span class="string">"contents"</span>&gt;
&lt;<span class="sgml-namespace">lift</span>:<span class="function-name">bind</span> <span class="variable-name">name</span>=<span class="string">"content"</span> /&gt;
&lt;/<span class="function-name">div</span>&gt;
&lt;/<span class="function-name">body</span>&gt;
&lt;/<span class="function-name">html</span>&gt;
</pre>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.