function PageHome(&$skeleton) { $articles = Entities::retrieveGroupedEntities(ARTICLES); $itemlist = new ItemList($skeleton); $itemlist->setBorders(array('top' => '-', 'bottom' => '-', 'left' => '+', 'right' => '+')); $ascii_article = new Article($skeleton, current($articles)); $skeleton->addWidget($ascii_article); $count = 0; while ($article = next($articles)) { ++$count; $text = ""; $text .= "[url="; $text .= Common::urlFor('view_article', array('token' => $article->getToken())) . ']'; $text .= "[b]" . $article->getCategory() . "[/b]"; $text .= "/" . $article->getTitle() . '[/url]'; $text .= " (" . $article->getDate() . ")"; if ($count < count($articles) - 1) { $text .= "\n"; } $itemlist->setText($text); } if ($count > 0) { $skeleton->addWidget($itemlist); } }
function SearchArticles($pattern, $skeleton) { $matches = 0; $articles = Entities::retrieveGroupedEntities(ARTICLES); $itemlist = new ItemList($skeleton); foreach ($articles as $article) { if (stristr($article->getContent(), $pattern)) { ++$matches; $link = Common::urlFor('view_article', array('token' => $article->getToken())); $itemlist->setText('<a href="' . $link . '">' . $article->getTitle() . '</a>'); } } $skeleton->addWidget($itemlist); return $matches; }
<feed xmlns="http://www.w3.org/2005/Atom"> <title>mxs_area</title> <subtitle><?php echo TITLE; ?> </subtitle> <link href="http://aimxhaisse.com/"/> <author> <name>Sebastien Rannou</name> <email>rannou.sebastien@gmail.com</email> </author> <?php foreach (Entities::retrieveGroupedEntities(ARTICLES) as $article) { ?> <entry> <title><?php echo $article->getTitle(); ?> </title> <link href="<?php echo ROOT_URI . Common::urlFor('view_article', array('token' => $article->getToken())); ?> "/> <updated><?php echo date(DATE_ATOM, $article->getTimestamp()); ?> </updated> <summary type="xhtml"><?php