Processwire: Unterschied zwischen den Versionen
Aus Wikizone
| Zeile 34: | Zeile 34: | ||
</form> | </form> | ||
| + | </pre> | ||
| + | === Topnav === | ||
| + | 1.Level | ||
| + | <pre> | ||
| + | <ul class='topnav'><?php | ||
| + | // top navigation consists of homepage and its visible children | ||
| + | foreach($homepage->and($homepage->children) as $item) { | ||
| + | if($item->id == $page->rootParent->id) { | ||
| + | echo "<li class='current'>"; | ||
| + | } else { | ||
| + | echo "<li>"; | ||
| + | } | ||
| + | echo "<a href='$item->url'>$item->title</a></li>"; | ||
| + | } | ||
| + | // output an "Edit" link if this page happens to be editable by the current user | ||
| + | if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>Edit</a></li>"; | ||
| + | ?></ul> | ||
</pre> | </pre> | ||
Version vom 5. Januar 2017, 14:03 Uhr
Installation
- Download
- Aufrufen Installer durchführen. Es gibt ein paar nette Starter Templates
- evtl. Über Module das schönere Reno Admin Template installieren (und im User Profil aktivieren)
Language Pack
- Language Pack Downloaden: http://modules.processwire.com/modules/german/
- ProcessWire Language Support module installieren (ist in ProcessWire enthalten).
Modules > Language > Language Support > install.
- Neue Sprache hinzufügen
Setup > Languages > Add New Language. Enter a title and name for the language and save.
- Dateien des Launguage Pack hinzufügen: Language Packs für das Backend kann man im Bereich Core Translation Files hochladen. Zip Files werden automatisch entpackt. Wenn das System das nicht unterstützt, kann man die JSON Dateien auspacken und direkt hochspielen.
- Im Profil Sprache einstellen.
ProcessWire Snippets
Breadcrumb
<!-- breadcrumbs -->
<div class='breadcrumbs'><?php
// breadcrumbs are the current page's parents
foreach($page->parents() as $item) {
echo "<span><a href='$item->url'>$item->title</a></span> ";
}
// optionally output the current page as the last item
echo "<span>$page->title</span> ";
?></div>
Searchbar
<!-- search form-->
<form class='search' action='<?php echo $pages->get('template=search')->url; ?>' method='get'>
<input type='text' name='q' placeholder='Search' value='<?php echo $sanitizer->entities($input->whitelist('q')); ?>' />
<button type='submit' name='submit'>Search</button>
</form>
1.Level
<ul class='topnav'><?php
// top navigation consists of homepage and its visible children
foreach($homepage->and($homepage->children) as $item) {
if($item->id == $page->rootParent->id) {
echo "<li class='current'>";
} else {
echo "<li>";
}
echo "<a href='$item->url'>$item->title</a></li>";
}
// output an "Edit" link if this page happens to be editable by the current user
if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>Edit</a></li>";
?></ul>