public function install() { $this->db()->queryMulti($this->getInstallSql()); $articleMapper = new \Modules\Article\Mappers\Article(); $catMapper = new \Modules\Article\Mappers\Category(); /* * @todo change content for different types. */ $cat = new \Modules\Article\Models\Category(); $cat->setName('Allgemein'); $catMapper->save($cat); $article = new \Modules\Article\Models\Article(); $article->setCatId(1); $article->setTitle('Startseite'); $article->setAuthorId(1); $article->setContent('Willkommen auf meiner Internetseite! Auf dieser Seite möchte ich mich als Person vorstellen.'); $article->setPerma('startseite.html'); $articleMapper->save($article); }
<?php $articleMapper = new \Modules\Article\Mappers\Article(); $archive = $this->get('archive'); ?> <?php if (!empty($archive)) { ?> <ul class="list-unstyled"> <?php foreach ($archive as $archiv) { ?> <?php $date = new \Ilch\Date($archiv->getDateCreated()); ?> <li> <a href="<?php echo $this->getUrl(array('module' => 'article', 'controller' => 'archive', 'action' => 'show', 'year' => $date->format("Y", true), 'month' => $date->format("m", true))); ?> "> <?php echo $date->format("F Y", true); ?> </a> <span class="badge pull-right" style="margin-top: 7px;"><?php echo $articleMapper->getCountArticlesByMonthYear($archiv->getDateCreated()); ?> </span> </li> <?php
<?php $articleMapper = new \Modules\Article\Mappers\Article(); $cats = $this->get('cats'); ?> <legend><?php echo $this->getTrans('menuCats'); ?> </legend> <?php if ($cats != '') { ?> <ul class="list-group"> <?php foreach ($cats as $cat) { ?> <li class="list-group-item"> <span class="badge"><?php echo count($articleMapper->getArticlesByCats($cat->getId())); ?> </span> <a href="<?php echo $this->getUrl(array('controller' => 'cats', 'action' => 'show', 'id' => $cat->getId())); ?> "><?php echo $cat->getName(); ?> </a> </li> <?php