viewing paste Unknown #7272 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?php if (!defined('FLUX_ROOT')) exit; 
 
$newsTable     = Flux::config('FluxTables.NewsTable');
$categoryTable = Flux::config('FluxTables.NewsCategoryTable');
$profileTable  = Flux::config('FluxTables.NewsProfileTable');
$col  = "n.news_title, n.news_desc, n.news_content, n.news_date_posted, ";
$col .= "np.name AS news_author, nc.name AS news_category, n.id";
$sql  = "SELECT $col FROM {$server->loginDatabase}.$newsTable AS n ";
$sql .= "LEFT JOIN {$server->loginDatabase}.$categoryTable AS nc ";
$sql .= "ON nc.id = n.news_category ";
$sql .= "LEFT JOIN {$server->loginDatabase}.$profileTable AS np ";
$sql .= "ON np.account_id = n.news_author ";
$sql .= "ORDER BY n.id DESC LIMIT 7";
$sth  = $server->connection->getStatement($sql);
$sth->execute();
$news = $sth->fetchAll();
 
?>
 
<?php if ($news): ?>
    <table cellspacing="0" cellpadding="2" width="100%">
        <?php foreach ($news as $article): ?>
            <tr>
                <td width="39"><div class="news_icon_<?php echo strtolower($article->news_category); ?>"></div></td>
                <td><a href="<?php echo $this->url('news', 'view', array('id' => $article->id)); ?>" class="news_title"><?php echo $article->news_title; ?></a></td>
                <td><span class="news_date"><?php echo date('m.d.y', strtotime($article->news_date_posted)); ?></span></td>
            </tr>
        <?php endforeach; ?>
    </table>
<?php else: ?>
<p class="not-applicable">No latest news</p>
<?php endif; ?>
Viewed 754 times, submitted by Guest.