public function health() { $articlesWell = ViewArticles::getAll("WHERE cat_name='Well' and article_status='1' and article_category_page_status='1' order by `article_time` desc limit 3"); $articlesMoneyPolicy = ViewArticles::getAll("WHERE cat_name='Money & Policy' and article_status='1' and article_category_page_status='1' order by `article_time` desc limit 3"); $articlesHealthGuide = ViewArticles::getAll("WHERE cat_name='Health Guide' and article_status='1' and article_category_page_status='1' order by `article_time` desc limit 3"); $topStory = ViewArticles::getAll("WHERE main_cat_name='Health' and article_status='1' and main_category_top_story='1' order by `article_time` desc limit 1"); $data = array($articlesWell, $articlesMoneyPolicy, $articlesHealthGuide, $topStory); $this->loadView("health", $data); }
</div> <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped table-bordered table-hover dataTables-example" id="dataTables-example"> <thead> <tr> <th>Article Image</th> <th>Article Information</th> <th>Action</th> </tr> </thead> <tbody> <?php /**********************************************************************************************/ $articles = ViewArticles::getAll(); //all articles from viewArticles foreach ($articles as $article) { echo "<tr class='odd gradeX'>\n <td><img src='../view/images/{$article->article_picture_small}'></td>\n <td>\n <b>Article ID:</b> {$article->article_id}<br>\n <b>Title:</b> {$article->article_title}<br>\n <b>Main Category:</b> {$article->main_cat_name}<br>\n <b>Cat:</b> {$article->cat_name}<br>\n <b>Created by:</b> {$article->article_creator}<br>\n <b>Published on:</b> {$article->article_time}<br>\n <b>Status: </b>" . ($article->article_status == 1 ? 'Show' : 'Hide') . "\n </td> \n <td>\n <a href='home.php?page=3&article_id={$article->article_id}' target='_blank'>Edit</a><br>\n <a href='../index.php?controller=News&method=index&id={$article->article_id}' target='_blank' >View article on site</a>\n </td>\n </tr>"; } /**********************************************************************************************/ ?> </tbody> </table> </div> </div> </div> <!--End Advanced Tables -->
</div> <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped table-bordered table-hover dataTables-example" id="dataTables-example"> <thead> <tr> <th>Article Image</th> <th>Article Information</th> <th>Action</th> </tr> </thead> <tbody> <?php if (isset($_GET['cat_name'])) { $cat_name = $_GET['cat_name']; $articles = ViewArticles::getAll("where main_cat_name='{$cat_name}' order by article_time desc"); foreach ($articles as $article) { echo "<tr class='odd gradeX'>\n <td><img src='../view/images/{$article->article_picture_small}'></td>\n <td>\n <b>Article ID:</b> {$article->article_id}<br>\n <b>Title:</b> {$article->article_title}<br>\n <b>Main Category:</b> {$article->main_cat_name}<br>\n <b>Cat:</b> {$article->cat_name}<br>\n <b>Created by:</b> {$article->article_creator}<br>\n <b>Published on:</b> {$article->article_time}<br>\n <b>Status: </b>" . ($article->article_status == 1 ? 'Show' : 'Hide') . "\n </td> \n <td>\n <a href='home.php?page=3&article_id={$article->article_id}' target='_blank'>Edit</a><br>\n <a href='../index.php?controller=News&method=index&id={$article->article_id}' target='_blank' >View article on site</a>\n </td>\n </tr>"; } } ?> </tbody> </table> </div> </div> </div> <!--End Advanced Tables -->