<?php $topicManager = new TopicManager($db); $topics = $topicManager->getList($_GET['id']); $userManager = new UserManager($db); $postManager = new PostManager($db); $i = 0; $c = count($topics); while ($i < $c) { $topic = $topics[$i]; $link = $userManager->findLink($_SESSION['id'], $topic->getId()); $userTopic = $userManager->findById($topic->getIdAuthor()); $lastPost = $postManager->getLastByTopic($topic->getId()); if ($lastPost == TRUE) { $userLastPost = $userManager->findById($lastPost->getIdAuthor()); $posts = $postManager->getList($topic->getId()); $Nrep = count($posts) - 1; } require 'views/forum/topics.phtml'; $i++; }
<?php $sCategoryManager = new SCategoryManager($db); $sCategorys = $sCategoryManager->getList($category->getId()); $topicManager = new TopicManager($db); $postManager = new PostManager($db); $a = 0; $b = count($sCategorys); while ($a < $b) { $sCategory = $sCategorys[$a]; $topic = $topicManager->getList($sCategory->getId()); $nTopic = count($topic); $post = $postManager->getListSCat($sCategory->getId()); $nPost = count($post); if ($nPost !== 0) { $lastPost = $postManager->getLastBySCat($sCategory->getId()); $userLastPost = $userManager->findById($lastPost->getIdAuthor()); } require 'views/forum/sCategorys.phtml'; $a++; }