July 2010
A post made in july
April 2010
Anothera article
Welcome to N-13 News 3.5
March 2010
asd asds
January 2010
xa das as
<?php
require_once 'news/db.php';
require_once 'news/config.php';
// Grab all news articles
$allnews = DataAccess::fetch("SELECT title,timestamp,$newstable.id,author FROM $newstable
LEFT JOIN $newsgroupcats ON $newstable.id = $newsgroupcats.storyid
LEFT JOIN $newscats ON $newsgroupcats.catid = $newscats.id
WHERE approved = '1'
ORDER BY timestamp DESC");
$dates = array();
$months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// loop through articles and grab the year, month and day then store them in the $dates array
$x = 0;
foreach($allnews AS $news){
$y = date("Y", $news['timestamp']);
$m = date("n", $news['timestamp']);
$d = date("d", $news['timestamp']);
// sort the articles into groups by month
$dates[$y][$m][$d]['id'] = $news['id'];
$dates[$y][$m][$d]['title'] = $news['title'];
$dates[$y][$m][$d]['timestamp'] = $news['timestamp'];
$dates[$y][$m][$d]['author'] = $news['author'];
$x++;
}
$i = 0;
/// loop trough the new dates array starting with the year
foreach($dates AS $year=>$val){
// loop through each month
foreach($val AS $key2=>$val2){
echo $months[$key2 - 1] . ' ' . $year . '<br />';
foreach($val2 AS $key3=>$val3){
// loop through each news article
echo '<a href="news/index.php?id=' . $val3['id'] . '">' .$val3['title'].'</a><br />';
}
echo "<br />";
$i++;
}
}
?>
<?php
$origauthor[] = 'OctNov08';
$newsorder = 'ASC';
include 'news/index.php';
?>
<?php
require_once 'news/db.php';
require_once 'news/config.php';
// Grab all news articles
$allnews = DataAccess::fetch("SELECT title,timestamp," . NEWS_ARTICLES . ".id,author FROM " . NEWS_ARTICLES . "
LEFT JOIN " . NEWS_GROUPCATS . " ON " . NEWS_ARTICLES . ".id = " . NEWS_GROUPCATS . ".storyid
LEFT JOIN " . NEWS_CATS . " ON " . NEWS_GROUPCATS . ".catid = " . NEWS_CATS . ".id
WHERE approved = '1'
ORDER BY timestamp DESC");
$dates = array();
$months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// loop through articles and grab the year, month and day then store them in the $dates array
$x = 0;
foreach($allnews AS $news){
$y = date("Y", $news['timestamp']);
$m = date("n", $news['timestamp']);
$d = date("d", $news['timestamp']);
// sort the articles into groups by month
$dates[$y][$m][$d]['id'] = $news['id'];
$dates[$y][$m][$d]['title'] = $news['title'];
$dates[$y][$m][$d]['timestamp'] = $news['timestamp'];
$dates[$y][$m][$d]['author'] = $news['author'];
$x++;
}
$i = 0;
/// loop trough the new dates array starting with the year
foreach($dates AS $year=>$val){
// loop through each month
foreach($val AS $key2=>$val2){
echo $months[$key2 - 1] . ' ' . $year . '<br />';
foreach($val2 AS $key3=>$val3){
// loop through each news article
echo '<a href="news/index.php?id=' . $val3['id'] . '">' .$val3['title'].'</a><br />';
}
echo "<br />";
$i++;
}
}
?>
echo $months[$key2 - 1] . ' ' . $year . '<br />';
foreach($val2 AS $key3=>$val3){
// loop through each news article
echo '<a href="news/index.php?id=' . $val3['id'] . '">' $val3['title'].'</a><br />';
}
<?php
require_once 'news/db.php';
require_once 'news/config.php';
$cat = array();
//Specify categories here
$cat[] = "Cat1";
$cat[] = "Cat2";
// Loop through specified categories to grab the IDs
$catids = array();
$group = '';
foreach($cat AS $catname){
$catid = DataAccess::fetch(sprintf("SELECT id FROM %s WHERE name = ?", NEWS_CATS), $catname);
if(count($catid) > 0){
$catids[] = $catid['0']['id'];
$group .= $catid['0']['id'] . ', ';
}
}
$group = trim($group, ", ");
// Grab all news articles
$allnews = "SELECT title,timestamp," . NEWS_ARTICLES . ".id,author FROM " . NEWS_ARTICLES . "
LEFT JOIN " . NEWS_GROUPCATS . " ON " . NEWS_ARTICLES . ".id = " . NEWS_GROUPCATS . ".storyid
LEFT JOIN " . NEWS_CATS . " ON " . NEWS_GROUPCATS . ".catid = " . NEWS_CATS . ".id
WHERE approved = '1'";
if(count($catids) > 0){
$allnews .= " AND " . NEWS_ARTICLES . ".id IN (SELECT " . NEWS_GROUPCATS . ".storyid FROM " . NEWS_GROUPCATS . " WHERE type = 'news' AND catid IN ($group))";
}
$allnews .= "ORDER BY timestamp DESC";
$allnews = DataAccess::fetch($allnews);
$dates = array();
$months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// loop through articles and grab the year, month and day then store them in the $dates array
$x = 0;
foreach($allnews AS $news){
$y = date("Y", $news['timestamp']);
$m = date("n", $news['timestamp']);
$d = date("d", $news['timestamp']);
// sort the articles into groups by month
$dates[$y][$m][$d]['id'] = $news['id'];
$dates[$y][$m][$d]['title'] = $news['title'];
$dates[$y][$m][$d]['timestamp'] = $news['timestamp'];
$dates[$y][$m][$d]['author'] = $news['author'];
$x++;
}
$i = 0;
/// loop trough the new dates array starting with the year
foreach($dates AS $year=>$val){
// loop through each month
foreach($val AS $key2=>$val2){
echo $months[$key2 - 1] . ' ' . $year . '<br />';
foreach($val2 AS $key3=>$val3){
// loop through each news article
// Show dat next the title of article
echo date('d M', $val3['timestamp']) .' <a href="news/index.php?id=' . $val3['id'] . '">' .$val3['title'].'</a><br />';
}
echo "<br />";
$i++;
}
}
?>
foreach($dates AS $year=>$val){
// loop through each month
foreach($val AS $key2=>$val2){
echo $months[$key2 - 1] . ' ' . $year . '<br />';
foreach($val2 AS $key3=>$val3){
// loop through each news article
// Show dat next the title of article
echo date('d M', $val3['timestamp']) .' <a href="news/index.php?id=' . $val3['id'] . '">' .$val3['title'].'</a><br />';
}
echo "<br />";
$i++;
}
}
echo $months[$key2 - 1] . ' ' . $year . '<br />';
echo '<span class="header">' . $months[$key2 - 1] . ' ' . $year . '</span><br />';
echo date('d M', $val3['timestamp']) .' <a href="news/index.php?id=' . $val3['id'] . '">' .$val3['title'].'</a><br />';