Posted by senquiem on November 18, 2009 at 11:14am
This code is destroyed by 10 news on a page.
Prompt me how to add the sheeting-out of pages here.
Thank you for a help!
<?php
$sql = "
SELECT
n.nid,
n.title,
d.field_date_value AS 'date',
t.field_teaser_value AS 'teaser',
b.field_body_value AS 'body'
FROM
node n LEFT JOIN
content_field_body b ON n.nid = b.nid LEFT JOIN
content_field_teaser t ON b.nid = t.nid LEFT JOIN
content_field_date d ON t.nid = d.nid
WHERE n.type = 'ancmnt'
ORDER BY date DESC
LIMIT 0 , 10
";
$results = db_query($sql);
while ( $a = db_fetch_object($results) ) {
print "<h4>".$a->title."</h4>";
if ($a->body) print $a->body;
else print $a->teaser;
global $user;
if($user->uid != 0) {
print '<span><a href="/node/'.$a->nid.'/edit">Edit</a></span>';
}
print '<p class="dotted"></p>';
} //endwhile
?>