Вход Регистрация
Файл: Arhmobi_esdcms/sys/widgets/themeday/index.php
Строк: 18
<?php

defined
('DCMS') or die;
$db = DB::me();
$listing = new listing();
$post = $listing->post();
$post->highlight = true;
$post->icon('thems');
$post->url = '/theme/';
$post->title = __('Все темы');
$res = $db->query("SELECT COUNT(*) FROM `theme`");
$sh = $res->fetchColumn();
$post->counter = $sh;

if (
$dcms->widget_items_count) {
    
    
$week = mktime(0, 0, 0, date('n'), -1);
    
$q = $db->prepare("SELECT * FROM `theme` WHERE `time` > ? ORDER BY `id` DESC LIMIT 1");
    
$q->execute(Array($week));
    while (
$theme = $q->fetch()) {
        
$post = $listing->post();
        
$post->icon('themy');
        
$post->title = 'Тема дня: '.text::toValue($theme['title']);
        
$post->url = '/theme/comments.php?id=' . $theme['id'];
        
$post->time = misc::when($theme['time']);
        
$post->highlight = $theme['time'] > NEW_TIME;
$res = $db->prepare("SELECT COUNT(*) FROM `theme_comments` WHERE `id_theme` = ?");
$res->execute(Array($theme['id']));
if(
$res){$post->bottom = 'Ответов: '.$res->fetchColumn();}
    }
}

$listing->display();
Онлайн: 1
Реклама