Template Plugins (CMS)
Für unser CMS gibt es gleich auch Templates für die Pluginauflistung. Diesmal ist es nicht wirklich viel: Nur ein Template und eben die dazugehörige PHP-Seite.
Fangen wir an mit dem Template /system/templates/plugins.html:
{LOOP:PLUGINS} <h2>{VAR:NAME}</h2> <p>{VAR:DESCRIPTION}</p> <p style="font-size:80%"> {VAR:VERSION} <a href="{VAR:AUTHORLINK}"> {VAR:AUTHORNAME} </a> </p> {VAR:ACTIVATIONLINK} {/LOOP:PLUGINS}
Die PHP-Datei /admin/includes/plugins.php sieht dann so aus:
<?PHP $template = new Template(); $template->load("plugins",".."); $plugins = new PluginList(); $plugins->loadAll(); foreach($plugins->plugins as $plugin){ $index = $template->add_loop_item("PLUGINS"); if($_GET['activate'] == $plugin->path){ $plugin->activate(); } elseif($_GET['deactivate'] == $plugin->path){ $plugin->deactivate(); } $template->assign_loop_var("PLUGINS",$index,"NAME",$plugin->name); $template->assign_loop_var("PLUGINS",$index,"DESCRIPTION",$plugin->description); $template->assign_loop_var("PLUGINS",$index,"VERSION",$plugin->version); $template->assign_loop_var("PLUGINS",$index,"AUTHORLINK",$plugin->authorLink); $template->assign_loop_var("PLUGINS",$index,"AUTHORNAME",$plugin->authorName); if($plugin->isActivated()){ $template->assign_loop_var("PLUGINS",$index,"ACTIVATIONLINK","<a href="/admin/index.php?page=plugins&deactivate=".urlencode($plugin->path)."">Deaktvieren</a>"); } else{ $template->assign_loop_var("PLUGINS",$index,"ACTIVATIONLINK","<a href="/admin/index.php?page=plugins&activate=".urlencode($plugin->path)."">Aktvieren</a>"); } } $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