Mecha CMS

Code snippet collection for developers.

Basic Page Tags

Author: Taufik Nurrohman · 92 Views

Tweet

List all tags from the current page.

Requires tags extension.

<?php

if (is_array($page->tags)) {
    $_tags = [];
    foreach ($page->tags as $v) {
        $_tags[$v->title] = HTML::a($v->title, $v->url);
    }
    ksort($_tags); // sort by title…
    echo 'Tags: ' . implode(', ', $_tags);
}

?>

0 Comments

No comments yet.