execute('SELECT p.id, p.title, p.seotitle, p.level, COUNT(v.postcat) as bobo FROM category p LEFT JOIN articles v ON v.postcat = p.id WHERE p.level = '.$DB->qstr('1').' GROUP BY p.id'); if(!$rb) print $DB->ErrorMsg(); else while(!$rb->EOF) { $category[] = $rb->fields; $rb->MoveNext(); } $rc = $DB->execute('SELECT * FROM articles ORDER BY postid DESC LIMIT 20'); if(!$rc) print $DB->ErrorMsg(); else{ while(!$rc->EOF) { //echo "
",print_r($rc->fields['date']),"
";die(); //$now = time(); // or your date as well //$your_date = strtotime($rc->fields['date']); //$datediff = $now - $your_date; $OldDate = new DateTime(date('Y-m-d',strtotime($rc->fields['date']))); $now = new DateTime(Date('Y-m-d')); $diff = $OldDate->diff($now); //echo $rc->fields['date']." ".$diff->d."
"; // print_r($OldDate->diff($now));die(); //var_dump($datediff); $rc->fields['days'] = $diff->format("%a"); $articles[] = $rc->fields; $rc->MoveNext(); } } //echo "
",print_r($articles),"
";die(); $rd = $DB->execute('SELECT * FROM comments ORDER BY rand() DESC LIMIT 50'); if(!$rd) print $DB->ErrorMsg(); else while(!$rd->EOF) { $comments[] = $rd->fields; $rd->MoveNext(); } $smarty->caching = $caching; $smarty->assign('category',@$category); $smarty->assign('articles',@$articles); $smarty->assign('comments',@$comments); include ('includes/menu.php'); $smarty->display('new.php'); $smarty->display('footer.php'); $DB->Close(); ?>

Top