Startseite NF

02.03.2022 - Lesezeit: 2 Minuten

<?php

function anzeige_ohne_caption($sql){ $result = db_query_range($sql,0,10); foreach ($result as $record) { $node=node_load($record->nid); $node->title = ''; $anzeige = node_view($node, 'full'); $rendered = render($anzeige); print $rendered; echo '


'; } }

function anzeige($sql,$caption=''){ $result = db_query_range($sql,0,10); if (($result->rowCount()>0) and ($caption<>'')) { echo '


'; echo '

'.$caption.'

'; echo '
'; } foreach ($result as $record) { $node=node_load($record->nid); $anzeige = node_view($node, 'teaser'); $rendered = render($anzeige); print $rendered; } }

// Das Intro anzeigen $sql = "SELECT * FROM {node} WHERE nid=1 ORDER BY created ASC"; anzeige_ohne_caption($sql);

// Die oben in Listen Termine anzeigen $sql = "SELECT * FROM {node} WHERE type = 'article' AND status = 1 AND nid<>1 AND promote=1 AND sticky=1 ORDER BY created ASC"; anzeige($sql,'');

// Die heutigen Termine anzeigen $sql = "SELECT * FROM {node} WHERE type = 'article' AND status = 1 AND nid<>1 AND promote=1 AND sticky=0 AND DATE(FROM_UNIXTIME(created))=CURDATE() ORDER BY created DESC"; anzeige($sql,'Heute in Niederfrohna');

//Zukunft anzeigen 28 Tage $sql = "SELECT * FROM {node} WHERE type = 'article' AND status = 1 AND nid<>1 AND promote=1 AND sticky=0 AND DATE(FROM_UNIXTIME(created))>CURDATE() AND FROM_UNIXTIME(created)<DATE_ADD(CURDATE(),INTERVAL 28 DAY) ORDER BY created ASC"; anzeige($sql,'Demnächst in Niederfrohna');

//Vergangenheit anzeigen $sql = "SELECT * FROM {node} WHERE type = 'article' AND status = 1 AND nid<>1 AND promote=1 AND DATE(FROM_UNIXTIME(created))<CURDATE() AND sticky<>1 ORDER BY created DESC"; anzeige($sql,'Das war los in Niederfrohna');

?>

Tags: php