29.07.2009, 15:01
Das folgende Subtemplate erlaubt es, mehrere Seiten in einem Dokument zu speichern und darin zu blättern:
Erstellen Sie eine neue Vorlage und kopieren Sie den obigen Code in den Quelltext.
![[Bild: page_function.jpg]](http://www.webcompro-cms.com/image/community/page_function.jpg)
Code:
<WCP:shift id=".s1"></WCP:shift>
<?php
$GLOBALS["temp"][$wcp_template_temp_id] = 1;
?>
<WCP:repeat id=".r1" default="3" title="Anzahl Seiten">
<WCP:shift id=".s1." edit="off">
<?php
$page = isset($GLOBALS["page"]) ? (int)$GLOBALS["page"] : 1;
$i = $GLOBALS["temp"][$wcp_template_temp_id];
$GLOBALS["temp"][$wcp_template_temp_id] = $i + 1;
$range = $wcp_template_base_id . "flag";
$wcp_template_document->set($range, "text", ($i === $page) ? "1" : "");
?>
<WCP:cblock idref=".flag">
<div style="BORDER-BOTTOM:1px dotted;MARGIN-BOTTOM:10px;PADDING-BOTTOM:10px">
<WCP:template title="Seiteninhalt"/>
</div>
</WCP:cblock>
</WCP:shift>
</WCP:repeat>
<div style="TEXT-ALIGN:right">
<?php
$page = isset($GLOBALS["page"]) ? (int)$GLOBALS["page"] : 1;
$range = $wcp_template_base_id . "r1";
$repeat = (int)$wcp_template_document->get($range);
if ($repeat === 0) $repeat = 3;
if ($page > 1)
echo("<a href=\"" . x(WCP_ACTIVE_URL . wcp_param(array("page" => $page - 1))) . "\">" .
"«" .
"</a> ");
for ($i = 1; $i <= $repeat; $i++)
echo("<a href=\"" . x(WCP_ACTIVE_URL . wcp_param(array("page" => $i))) . "\">" .
(($i === $page) ? "<strong>$i</strong>" : $i) .
"</a>" .
(($i < $repeat) ? " | " : ""));
if ($page < $repeat)
echo(" | " .
"<a href=\"" . x(WCP_ACTIVE_URL . wcp_param(array("page" => $page + 1))) . "\">" .
WCP_L_COMMAND_NEXT . " »" .
"</a>");
?>
</div>Erstellen Sie eine neue Vorlage und kopieren Sie den obigen Code in den Quelltext.
![[Bild: page_function.jpg]](http://www.webcompro-cms.com/image/community/page_function.jpg)