Menü Templates Teil 1 (CMS)
Im CMS ContentLion werden wir heute alles was im Admin-Bereich mit Menüs zu tun hat mit Templates ausstatten. Starten wir mit der Menüübersicht. Diese bekommt das Template /system/templates/menus.html:
<h1>{LANG:MENUS}</h1> <p> <a href="{VAR:NEWMENUURL}">{LANG:NEW_MENU}</a> </p> <table> <thead> <tr> <td><strong>{LANG:ID}</strong></td> <td><strong>{LANG:NAME}</strong></td> <td><strong>{LANG:PAGES}</strong></td> <td><strong>{LANG:ACTIONS}</strong></td> </tr> </thead> <tbody> {LOOP:MENUS} <tr> <td>{VAR:ID}</td> <td>{VAR:NAME}</td> <td>{VAR:PAGES}</td> <td> <a title="Bearbeiten" href="{VAR:EDITURL}"> <img src="{ICON:PAGE_EDIT}" /> </a> <a title="Löschen" href="{VAR:DELETEURL}"> <img src="{ICON:CROSS}" /> </a> </td> </tr> {/LOOP:MENUS} </tbody> </table>
Die dazugehörige Datei /admin/includes/menues.php sieht so aus:
<?PHP $template = new Template(); $template->load("menus","../"); $template->assign_var("NEWMENUURL","/admin/index.php?page=menue-new"); foreach(sys::getMenues() as $menu){ $index = $template->add_loop_item("MENUS"); $template->assign_loop_var("MENUS", $index, "ID", $menu->id); $template->assign_loop_var("MENUS", $index, "NAME", $menu->name); $template->assign_loop_var("MENUS", $index, "PAGES", $menu->count); $template->assign_loop_var("MENUS", $index, "EDITURL", "index.php?page=menu-edit&menu=".$menu->id); $template->assign_loop_var("MENUS", $index, "DELETEURL", "index.php?page=menu-delete&menu=".$menu->id); } $template->output(); ?>
Du arbeitest in einer Agentur oder als Freelancer?
Dann wirf doch mal einen Blick auf unsere Software FeatValue.
Über uns
![Stefan Wienströer](/i/stefan-264.png)
Wir entwickeln Webanwendungen mit viel Leidenschaft. Unser Wissen geben wir dabei gerne weiter. Mehr über a coding project