public static function tag( $args ) { $tag = str_replace('_', ' ', urldecode($args[0])); $filtred = array(); $post = ModelHandler::get("Posts"); for ($i = 0; $i < count($post); $i++) { $tags = explode(',', $post[$i]->bean['tags']); if(in_array($tag, $tags) ) $filtred[] = $post[$i]; } $post = $filtred; for ($i = 0; $i < count($post); $i++) { $newtags = ""; $tags = explode(',', $post[$i]->bean['tags']); foreach ($tags as $tag) { $newtags .= "<a href='/?/posts/tag/".$tag."'>".$tag."</a>, "; } $post[$i]->bean['tags'] = substr($newtags, 0, strlen($newtags)-2); } $post = array_reverse($post); $content = ViewHandler::wrapGroup("post", $post); Template::reset(); Template::assign("content",$content); Template::assign("allpostslink",""); echo Template::render("main.html"); }
public static function wrap($as, $item) { Template::reset(); $stls = self::getStyles( $item->model ); foreach ($item->bean as $key => $value) { Template::assign($key,$value); } foreach (self::$conststants as $const => $value){ Template::assign($const,eval($value)); } $html = str_replace("{itemmodel}", $item->model, self::$itemTpl); $html = str_replace("{itemid}", $item->id, $html); $html = str_replace("{itemstyle}", $as, $html); $html = str_replace("{additional}", Template::render( $stls[$as][1], false), $html); $source = $stls[$as][2]; $html = str_replace("{itemhtml}", Template::render($source,false), $html); return Template::render($html,false); }
<? foreach ($packages as $package => $gears): ?> <div class="package collapsible" id="package-<?php echo $package; ?> "> <h1><?php echo t($package, 'Packages'); ?> <a href="#" class="edit handler">-</a></h1> <div class="gears container"> <? $tpl = new Template('Gears.item') ?> <? foreach ($gears as $name => $gear): ?> <? $tpl->reset(); $tpl->assign($gear->info()); echo $tpl->render(); ?> <? endforeach; ?> </div> </div> <? endforeach; ?>
$tpl->set('s', 'ERRORS_HEADLINE_CATNAME', i18n("Category", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_DESCRIPTION', i18n("Description", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_LINK', i18n("Linkerror", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_LINKS_ARTICLES', i18n("Links to articles", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_LINKS_CATEGORYS', i18n("Links to categories", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_LINKS_DOCIMAGES', i18n("Links to documents and images", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_OTHERS', i18n("Links to extern sites and not defined links", $plugin_name)); $tpl->set('s', 'ERRORS_HEADLINE_WHITELIST', "Whitelist"); $tpl->set('s', 'ERRORS_HELP_ERRORS', i18n("Wrong links", $plugin_name)); // error_output initialization $aError_output = array('art' => '', 'cat' => '', 'docimages' => '', 'others' => ''); foreach ($aErrors as $sKey => $aRow) { $aRow = linksort($aRow); for ($i = 0; $i < count($aRow); $i++) { $tpl2 = new Template(); $tpl2->reset(); $tpl2->set('s', 'ERRORS_ERROR_TYPE', $aRow[$i]['error_type']); $tpl2->set('s', 'ERRORS_ARTID', $aRow[$i]['idart']); $tpl2->set('s', 'ERRORS_ARTICLE', $aRow[$i]['nameart']); $tpl2->set('s', 'ERRORS_ARTICLE_SHORT', substr($aRow[$i]['nameart'], 0, 20) . (strlen($aRow[$i]['nameart']) > 20 ? ' ...' : '')); $tpl2->set('s', 'ERRORS_CATID', $aRow[$i]['idcat']); $tpl2->set('s', 'ERRORS_LINK', $aRow[$i]['url']); $tpl2->set('s', 'ERRORS_LINK_ENCODE', base64_encode($aRow[$i]['url'])); $tpl2->set('s', 'ERRORS_LINK_SHORT', substr($aRow[$i]['url'], 0, 55) . (strlen($aRow[$i]['url']) > 55 ? ' ...' : '')); $tpl2->set('s', 'ERRORS_CATNAME', $aRow[$i]['namecat']); $tpl2->set('s', 'ERRORS_CATNAME_SHORT', substr($aRow[$i]['namecat'], 0, 20) . (strlen($aRow[$i]['namecat']) > 20 ? ' ...' : '')); $tpl2->set('s', 'MODE', $_GET['mode']); $tpl2->set('s', 'URL', $aUrl['contenido']); $tpl2->set('s', 'SID', $sess->id); if ($aRow[$i]['error_type'] == "unknown") { $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Unknown: articles, documents etc. do not exist.", $plugin_name));