News Headlines on Index Page (Technics)
I love this thing!
Anyway, to save time for those getting started...
set content_function to 1 in Administration → Settings → Advanced settings
Throw the php function below into includes/functions.inc.php and edit as necessary
--------------------------------------
function get_latest_news_headlines($limit) {
$dbr = Database::$content->query("
SELECT page, title, time FROM ".Database::$db_settings['pages_table']." WHERE sections = 'news' AND content_type = '' AND status > 0 AND NOT type = 'news' ORDER BY time DESC LIMIT " . $limit);
$headlines = '';
while ( $row = $dbr->fetch() ) {$headlines .= "<li><a href=\"" . $row['page'] . "\">" . $row['title'] . "</a><span class=\"timestamp\"> " . date("l, M j, Y",$row['time']) . "</span></li>";}
return $headlines;
}
--------------------------------------
and add the following into the index page.
<ul id="headlines">
[function:get_latest_news_headlines(5)]
</ul>
Complete thread:
- News Headlines on Index Page - Ryan, 2010-05-30, 19:12
(Technics)- News Headlines on Index Page - Ryan, 2010-06-11, 11:26
- News Headlines on Index Page - moho, 2010-06-11, 16:02
![Show preview […]](templates/default/images/ajax_preview.png)
- News Headlines on Index Page - Ryan, 2010-06-11, 18:42
![Show preview […]](templates/default/images/ajax_preview.png)
- News Headlines on Index Page - Ryan, 2010-06-11, 18:42
- News Headlines on Index Page - moho, 2010-06-11, 16:02
- News Headlines on Index Page (using simple news) - Ryan, 2010-06-23, 18:38
![Show preview […]](templates/default/images/ajax_preview.png)
- News Headlines on Index Page - Ryan, 2010-06-11, 11:26