当前位置: 首页>>代码示例>>PHP>>正文


PHP News::SetCategoryId方法代码示例

本文整理汇总了PHP中News::SetCategoryId方法的典型用法代码示例。如果您正苦于以下问题:PHP News::SetCategoryId方法的具体用法?PHP News::SetCategoryId怎么用?PHP News::SetCategoryId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在News的用法示例。


在下文中一共展示了News::SetCategoryId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

<?php

/*
	29 december 2010: cleanup while trying to add
		status field to typef_news table;
		rewrote to use news categories class
	3 january 2011: DAOFactory, not DAO_Factory;
		setCategoryId now static
	28 march 2011: merged in HL code
	29 march 2011: added page title, header
*/
// define some handy shortcuts to save typing
$settings = Typeframe::CurrentPage()->settings();
if (Typeframe::CurrentPage()->pathInfo()) {
    Typeframe::IncludeScript('/news/categories/view.php');
    return;
}
if (is_array($settings['categoryid']) && !in_array(0, $settings['categoryid']) && 1 == count($settings['categoryid'])) {
    Typeframe::Redirect('Redirecting to category listing...', Typeframe::CurrentPage()->applicationUri() . 'categories/' . $settings['categoryid'][0]);
    return;
}
// create news category object
$categories = News_Category::DAOFactory();
// limit to a particular category id
News::SetCategoryId($categories, @$settings['categoryid']);
// add categories to template
$pm->setVariable('categories', $categories);
// add page title and header to template
$title = News::GetTitle();
$pm->setVariable('page_title', $title);
$pm->setVariable('page_header', $title);
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:index.php

示例2: News_Category

}
// 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);
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:view.php

示例3: urldecode

$settings = Typeframe::CurrentPage()->settings();
// get tag
$tag = urldecode(Typeframe::CurrentPage()->pathInfo());
if ('' == $tag) {
    $tag = @$_REQUEST['tag'];
}
// validate tag
if (!$tag) {
    Typeframe::Redirect('Invalid tag specified.', Typeframe::CurrentPage()->applicationUri(), 1);
    return;
}
// add tag to template
$pm->setVariable('tag', $tag);
// create news article object
$articles = News_Article::DAOFactory();
// limit to a particular category id
News::SetCategoryId($articles, @$settings['categoryid']);
// limit to a particular tag
$articles->select()->innerJoin('#__news_tag AS nt', '#__news.newsid = nt.newsid');
$articles->select()->where('nt.tag = ?', $tag);
// 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);
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:view.php


注:本文中的News::SetCategoryId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。