Пример #1
0
}
// create news category object
$category = new News_Category($categoryid);
// redirect if category id is invalid
if (!$category->exists()) {
    Typeframe::Redirect('Invalid category specified.', Typeframe::CurrentPage()->applicationUri(), 1);
    return;
}
// determine if there are 0 or more than 1 categories; add flag to template
if (in_array(0, $settings['categoryid']) || count($settings['categoryid']) > 1) {
    $pm->setVariable('multicats', true);
}
// add category name, id, and object to template
$pm->setVariable('categoryname', $category->get('categoryname'));
$pm->setVariable('categoryid', $category->get('categoryid'));
$pm->setVariable('category', $category);
// create news article object
$articles = News_Article::DAOFactory();
// filter by category id
News::SetCategoryId($articles, $category->get('categoryid'));
// add articles to template
$pm->setVariable('news', $articles);
// get comment types
$comment_types = CommentType::DAOFactory();
$comment_types->select()->order('name');
// add comment types to template
$pm->setVariable('comment_types', $comment_types);
// add page title and header to template
$title = News::GetTitle();
$pm->setVariable('page_title', $title);
$pm->setVariable('page_header', $title);