本文整理汇总了PHP中getCategory函数的典型用法代码示例。如果您正苦于以下问题:PHP getCategory函数的具体用法?PHP getCategory怎么用?PHP getCategory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCategory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: position_del
/**
* 推荐位删除计算
* Enter description here ...
* @param int $catid 栏目ID
* @param int $id 文章id
* @param array $input_posid 传入推荐位数组
*/
private function position_del($catid, $id, $input_posid)
{
$array = array();
$pos_data = M("Position_data");
//查找已存在推荐位
$olPosid = $pos_data->where(array('id' => $id, 'catid' => $catid))->getField('posid', true);
if (empty($olPosid)) {
return false;
}
//差集计算,需要删除的推荐
$real_posid = array_diff($olPosid, $input_posid);
if (empty($real_posid)) {
return false;
}
$where = array();
$where['catid'] = array("EQ", $catid);
$where['modelid'] = getCategory($catid, 'modelid');
$where['id'] = array("EQ", $id);
$where['posid'] = array("IN", $real_posid);
$status = $pos_data->where($where)->delete();
if (false !== $status) {
service("Attachment")->api_delete('position-' . $where['modelid'] . '-' . $where['id']);
return true;
} else {
return false;
}
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:34,代码来源:PositionModel.class.php
示例2: index
public function index()
{
$this->assign('LatestArticles', getLatest());
$this->assign('categories', getCategory());
$this->assign('allTags', getAllTags());
$this->type = $this->_get('type');
$this->typevalue = $this->_get('typevalue');
$page = isset($_GET['page']) ? $_GET['page'] : 1;
switch ($this->_get('type')) {
case 'username':
$this->UserName($this->_get('typevalue'), $page);
break;
case 'userid':
$this->UserId($this->_get('typevalue'), $page);
break;
case 'tag':
$this->Tag($this->_get('typevalue'), $page);
break;
case 'category':
$this->Category($this->_get('typevalue'), $page);
break;
case 'search':
$this->Search($this->_get('keywords'), $page);
break;
default:
$this->error('出错了');
}
//模板输出
$this->display('articlelist');
}
开发者ID:usaradman,项目名称:AlphaBlog,代码行数:30,代码来源:ArticlesAction.class.php
示例3: category
public function category()
{
$mid = Q('mid', 0, 'intval');
$cid = Q('cid', 0, 'intval');
$cache = cache('category');
if (!$mid || !$cid || !isset($cache[$cid])) {
_404();
}
$cachetime = C('CACHE_CATEGORY') >= 1 ? C('CACHE_CATEGORY') : null;
if (!$this->isCache()) {
$category = $cache[$cid];
//外部链接,直接跳转
if ($category['cattype'] == 3) {
go($category['cat_redirecturl']);
} else {
$Model = ContentViewModel::getInstance($category['mid']);
$catid = getCategory($category['cid']);
$category['content_num'] = $Model->join()->where("cid IN(" . implode(',', $catid) . ")")->count();
$category['comment_num'] = intval(M('comment')->where("cid IN(" . implode(',', $catid) . ")")->count());
$this->assign("hdcms", $category);
$this->display($category['template'], $cachetime);
}
} else {
$this->display(null, $cachetime);
}
}
开发者ID:jyht,项目名称:v5,代码行数:26,代码来源:IndexControl.class.php
示例4: posid
/**
* 推荐字段类型表单组合处理
* @param type $field 字段名
* @param type $value 字段内容
* @param type $fieldinfo 字段配置
* @return string
*/
function posid($field, $value, $fieldinfo)
{
//扩展配置
$setting = unserialize($fieldinfo['setting']);
//推荐位缓存
$position = F("Position");
if (empty($position)) {
return '';
}
$array = array();
foreach ($position as $_key => $_value) {
if ($_value['modelid'] && $_value['modelid'] != $this->modelid || $_value['catid'] && strpos(',' . getCategory($_value['catid'], 'arrchildid') . ',', ',' . $this->catid . ',') === false) {
continue;
}
$array[$_key] = $_value['name'];
}
$posids = array();
if (ACTION_NAME == 'edit') {
$this->position_data_db = M('Position_data');
$result = $this->position_data_db->where(array('id' => $this->id, 'modelid' => $this->modelid))->getField("posid,id,catid,posid,module,modelid,thumb,data,listorder,expiration,extention,synedit");
$posids = implode(',', array_keys($result));
} else {
$posids = $setting['defaultvalue'];
}
return "<input type='hidden' name='info[{$field}][]' value='-1'>" . Form::checkbox($array, $posids, "name='info[{$field}][]'", '', $setting['width']);
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:33,代码来源:form.inc.php
示例5: getBacklink
function getBacklink($id, $type, $category = true)
{
$db =& JFactory::getDBO();
if (!$category) {
$query = "SELECT articleid from #__fieldsattach_values WHERE (value LIKE '%," . $id . ",%' OR value LIKE '" . $id . ",%' OR value LIKE '%," . $id . "' OR value LIKE '" . $id . "') AND fieldsid = 23";
} else {
$query = "SELECT catid from #__fieldsattach_categories_values WHERE (value LIKE '%," . $id . ",%' OR value LIKE '" . $id . ",%' OR value LIKE '%," . $id . "' OR value LIKE '" . $id . "') AND fieldsid = 22";
}
$db->setQuery($query);
$result = $db->loadObjectList();
$function = '';
foreach ($result as $item) {
if (!$category) {
$parent = getParent(getCategory($item->articleid));
} else {
$parent = getParent($item->catid);
}
if ($parent == $type) {
if (!$category) {
$function .= '<li><a href="' . ContentHelperRoute::getArticleRoute($item->articleid, $parent) . '">' . getTitle($item->articleid, $category) . '</a></li>';
} else {
$function .= '<li><a href="' . ContentHelperRoute::getCategoryRoute($item->catid, $parent) . '">' . getTitle($item->catid, $category) . '</a></li>';
}
}
}
return $function;
}
开发者ID:AxelFG,项目名称:ckbran-inf,代码行数:27,代码来源:helper.php
示例6: detail
public function detail()
{
if (isAjaxTable()) {
return $this->_detail();
}
$this->view()->assign('my_shop', getMyShop())->assign('category', getCategory())->display();
}
开发者ID:frycnx,项目名称:jxc,代码行数:7,代码来源:Stock.php
示例7: public_item
/**
* 信息管理
*/
public function public_item()
{
if (IS_POST) {
$items = count($_POST['items']) > 0 ? $_POST['items'] : $this->error("没有信息被选择!");
$db = D("Position_data");
if (is_array($items)) {
foreach ($items as $item) {
$_v = explode('-', $item);
$db->delete_item((int) $_POST['posid'], (int) $_v[0], (int) $_v[1]);
}
}
$this->success("移除成功!");
} else {
$posid = $this->_get("posid");
$db = M("Position_data");
$Category = F("Category");
$where = array();
$where['posid'] = array("EQ", $posid);
$count = $db->where($where)->count();
$page = $this->page($count, 20);
$data = $db->where($where)->order(array("listorder" => "DESC", "id" => "DESC"))->limit($page->firstRow . ',' . $page->listRows)->select();
foreach ($data as $k => $v) {
$data[$k]['data'] = unserialize($v['data']);
$tab = ucwords(getModel(getCategory($v['catid'], 'modelid'), 'tablename'));
$data[$k]['data']['url'] = M($tab)->where(array("id" => $v['id']))->getField("url");
}
$this->assign("Category", $Category);
$this->assign("Page", $page->show('Admin'));
$this->assign("data", $data);
$this->assign("posid", $posid);
$this->display();
}
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:36,代码来源:PositionAction.class.php
示例8: validate_data
/**
* Validates imported data.
*/
function validate_data($courses)
{
$errors = array();
$coursecodes = array();
foreach ($courses as $index => $course) {
$course['line'] = $index + 1;
// 1. Check whether mandatory fields are set.
$mandatory_fields = array('Code', 'Title', 'CourseCategory');
foreach ($mandatory_fields as $field) {
if (!isset($course[$field]) || strlen($course[$field]) == 0) {
$course['error'] = get_lang($field . 'Mandatory');
$errors[] = $course;
}
}
// 2. Check current course code.
if (isset($course['Code']) && strlen($course['Code']) != 0) {
// 2.1 Check whether code has been already used by this CVS-file.
if (isset($coursecodes[$course['Code']])) {
$course['error'] = get_lang('CodeTwiceInFile');
$errors[] = $course;
} else {
// 2.2 Check whether course code has been occupied.
$courseInfo = api_get_course_info($course['Code']);
if (!empty($courseInfo)) {
$course['error'] = get_lang('CodeExists');
$errors[] = $course;
}
}
$coursecodes[$course['Code']] = 1;
}
// 3. Check whether teacher exists.
$teacherList = getTeacherListInArray($course['Teacher']);
if (!empty($teacherList)) {
foreach ($teacherList as $teacher) {
$teacherInfo = api_get_user_info_from_username($teacher);
if (empty($teacherInfo)) {
$course['error'] = get_lang('UnknownTeacher') . ' (' . $teacher . ')';
$errors[] = $course;
} else {
/*if ($teacherInfo['status'] != COURSEMANAGER) {
$course['error'] = get_lang('UserIsNotATeacher').' ('.$teacher.')';
$errors[] = $course;
}*/
}
}
}
// 4. Check whether course category exists.
if (isset($course['CourseCategory']) && strlen($course['CourseCategory']) != 0) {
require_once api_get_path(LIBRARY_PATH) . 'course_category.lib.php';
$categoryInfo = getCategory($course['CourseCategory']);
if (empty($categoryInfo)) {
//@todo this is so bad even all lang variables are wrong ...
$course['error'] = get_lang('UnkownCategoryCourseCode') . ' (' . $course['CourseCategory'] . ')';
$errors[] = $course;
}
}
}
return $errors;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:62,代码来源:course_import.php
示例9: index
public function index()
{
$data = isset($_GET['page']) ? $_GET['page'] : 1;
$this->show($data);
$this->assign('LatestArticles', getLatest());
$this->assign('categories', getCategory());
$this->assign('allTags', getAllTags());
$this->display();
}
开发者ID:usaradman,项目名称:AlphaBlog,代码行数:9,代码来源:IndexAction.class.php
示例10: add
public function add()
{
$sn = get('sn');
if (empty($sn)) {
$row = array('sn' => m('StockIncome')->getSn(), 'shop_id' => session('shop_id'), 'user_name' => session('user_name'), 'status' => '0');
} else {
$row = m('StockIncome')->getRowBySn($sn);
}
$this->view()->assign('row', $row)->assign('my_shop', getMyShop())->assign('category', getCategory())->display();
}
开发者ID:frycnx,项目名称:jxc,代码行数:10,代码来源:StockIncome.php
示例11: index
public function index()
{
$where = array();
$catid = I('get.catid', 0, 'intval');
$rssid = I('get.rssid', 0, 'intval');
if ($rssid) {
header("Content-Type: text/xml; charset=" . C("DEFAULT_CHARSET"));
//检测缓存
$data = S("Rss_{$rssid}");
if ($data) {
echo $data;
exit;
}
$Cat = getCategory($rssid);
//检查栏目是否存在
if (empty($Cat)) {
$this->error('该栏目不存在!');
}
//检查栏目类型
if ($Cat['type'] != 0) {
$this->error('栏目类型不正确!');
}
$where['status'] = array("EQ", 99);
//判断是否有子栏目
if (getCategory($rssid, 'child')) {
$where['catid'] = array("IN", getCategory($rssid, 'arrchildid'));
} else {
$where['catid'] = array("EQ", $rssid);
}
//模型ID
$modelid = getCategory($rssid, 'modelid');
//获取表名
$tablename = ucwords(getModel($modelid, 'tablename'));
if (empty($tablename)) {
$this->error('出现错误!');
}
//栏目配置
$setting = getCategory($rssid, 'setting');
$data = M($tablename)->where($where)->order(array("updatetime" => "DESC", "id" => "DESC"))->limit(50)->select();
import('@.ORG.Rss');
$Rss = new Rss($this->XMLstr(getCategory($rssid, 'catname') . ' - ' . CONFIG_SITENAME), $this->XMLstr(getCategory($rssid, 'url')), $this->XMLstr(getCategory($rssid, 'description')), $this->XMLstr(getCategory($rssid, 'image')));
foreach ($data as $k => $v) {
$v = $this->XMLstr($v);
$Rss->AddItem($v['title'], $v['url'], $v['description'], date("Y-m-d H:i:s A", $v['updatetime']));
}
//进行缓存
S("Rss_{$rssid}", $Rss->Fetch(), 900);
$Rss->Display();
}
$this->assign('catid', $catid);
$this->assign('rssid', $rssid);
$this->assign("SEO", seo(0, 'Rss订阅中心'));
$this->display();
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:54,代码来源:RssAction.class.php
示例12: position
/**
* 推荐位数据获取
* 参数名 是否必须 默认值 说明
* posid 是 null 推荐位ID
* catid 否 null 调用栏目ID
* thumb 否 0 是否仅必须缩略图
* order 否 null 排序类型
* num 是 null 数据调用数量
* @param type $data
*/
public function position($data)
{
//缓存时间
$cache = (int) $data['cache'];
$cacheID = to_guid_string($data);
if ($cache && ($return = S($cacheID))) {
return $return;
}
$posid = (int) $data['posid'];
if ($posid < 1) {
return false;
}
$catid = (int) $data['catid'];
$thumb = isset($data['thumb']) ? $data['thumb'] : 0;
$order = empty($data['order']) ? array("listorder" => "DESC", "id" => "DESC") : $data['order'];
$num = (int) $data['num'];
$db = M("PositionData");
$Position = F("Position");
if ($num == 0) {
$num = $Position[$posid]['maxnum'];
}
$where = array();
//设置SQL where 部分
if (isset($data['where']) && $data['where']) {
$where['_string'] = $data['where'];
}
$where['posid'] = array("EQ", $posid);
if ($thumb) {
$where['thumb'] = array("EQ", 1);
}
if ($catid > 0) {
$cat = getCategory($catid);
if ($cat) {
//是否包含子栏目
if ($cat['child']) {
$where['catid'] = array("IN", $cat['arrchildid']);
} else {
$where['catid'] = array("EQ", $catid);
}
}
}
$data = $db->where($where)->order($order)->limit($num)->select();
foreach ($data as $k => $v) {
$data[$k]['data'] = unserialize($v['data']);
$tab = ucwords(getModel($v['modelid'], 'tablename'));
$data[$k]['data']['url'] = M($tab)->where(array("id" => $v['id']))->getField("url");
}
//结果进行缓存
if ($cache) {
S($cacheID, $data, $cache);
}
return $data;
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:63,代码来源:PositionTagLib.class.php
示例13: add
public function add()
{
if (isPost()) {
return $this->_add();
}
$sn = get('sn');
if ($sn) {
$row = m('GoodsBind')->getRowBySn($sn);
} else {
$row = array('sn' => m('GoodsBind')->getSn(), 'shop_id' => session('shop_id'), 'user_name' => session('user_name'), 'status' => '0');
}
$this->view()->assign('row', $row)->assign('my_shop', getMyShop())->assign('category', getCategory())->display();
}
开发者ID:frycnx,项目名称:jxc,代码行数:13,代码来源:GoodsBind.php
示例14: bmiLogicHere
function bmiLogicHere($split)
{
if (sizeof($split) < 2) {
$responseMsg = "Invalid message content";
} else {
$weight = (double) $split[0];
$height = (double) $split[1];
$bmi = getBMIValue($weight, $height / 100);
$category = getCategory($bmi);
$responseMsg = "Your BMI :" . round($bmi, 2) . ", Category :" . $category;
}
return $responseMsg;
}
开发者ID:akriot,项目名称:iot,代码行数:13,代码来源:SampleSmsApp.php
示例15: catid
/**
* 栏目字段
* @param type $field 字段名
* @param type $value 字段值
* @param type $fieldinfo 该字段的配置信息
* @return type
*/
function catid($field, $value, $fieldinfo)
{
if (empty($value)) {
//当值为空时,获取当前添加的栏目ID
$value = $this->catid;
}
//html
$publish_str = '';
if (ACTION_NAME == 'add' && defined("IN_ADMIN") && IN_ADMIN) {
$publish_str = "<a href='javascript:;' onclick=\"omnipotent('selectid','" . U("Contents/Content/public_othors", array("catid" => $this->catid)) . "','同时发布到其他栏目',1);return false;\" style='color:#B5BFBB'>[同时发布到其他栏目]</a>\n <ul class='three_list cc' id='add_othors_text'></ul>";
}
$publish_str = '<input type="hidden" name="info[' . $field . ']" value="' . $value . '"/>' . getCategory($value, 'catname') . $publish_str;
return $publish_str;
}
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:21,代码来源:form.inc.php
示例16: processMatches
function processMatches($ds, $type)
{
foreach ($ds as $d) {
if (!is_null($d['label']) && !is_null($d['icon'])) {
$q = "INSERT INTO matches (uri, poslabel, label, icon, type, category) VALUES ('" . mysql_real_escape_string($d['pos']) . "', '" . mysql_real_escape_string($d['poslabel']) . "', '" . mysql_real_escape_string($d['label']) . "', '" . mysql_real_escape_string($d['icon']) . "', '" . mysql_real_escape_string($type) . "', '" . mysql_real_escape_string(getCategory($d['icon'])) . "')";
} elseif (!is_null($d['label'])) {
$q = "INSERT INTO matches (uri, poslabel, label, type) VALUES ('" . mysql_real_escape_string($d['pos']) . "', '" . mysql_real_escape_string($d['poslabel']) . "', '" . mysql_real_escape_string($d['label']) . "', '" . mysql_real_escape_string($type) . "')";
} elseif (!is_null($d['icon'])) {
$q = "INSERT INTO matches (uri, poslabel, icon, type, category) VALUES ('" . mysql_real_escape_string($d['pos']) . "', '" . mysql_real_escape_string($d['poslabel']) . "', '" . mysql_real_escape_string($d['icon']) . "', '" . mysql_real_escape_string($type) . "', '" . mysql_real_escape_string(getCategory($d['icon'])) . "')";
} else {
$q = "INSERT INTO matches (uri, poslabel, type) VALUES ('" . mysql_real_escape_string($d['pos']) . "', '" . mysql_real_escape_string($d['poslabel']) . "', '" . mysql_real_escape_string($type) . "')";
}
runQuery($q);
}
}
开发者ID:rprince,项目名称:opendatamap,代码行数:15,代码来源:makecache.php
示例17: getCategory
function getCategory($parentId = null)
{
global $dbIn;
if ($parentId == null) {
$result = $dbIn->query("SELECT * FROM Categorieen WHERE Parent = -1 ORDER BY ID ASC");
} else {
$result = $dbIn->buildQuery("SELECT * FROM Categorieen WHERE Parent=%d", $parentId);
}
$categories = array();
while ($row = $dbIn->fetchAssoc($result)) {
$row['sub'] = getCategory($row['ID']);
$categories[] = $row;
}
return $categories;
}
开发者ID:K-4U,项目名称:Pr-IP-P2-02,代码行数:15,代码来源:Conversion.php
示例18: getCategory
function getCategory($id)
{
global $db;
// echo "SELECT * FROM catalog_categories WHERE `id`='$id'";
$query_select = $db->query("SELECT * FROM catalog_categories WHERE `id`='{$id}'");
$res = $db->fetch_assoc($query_select);
$result[$res['id']] = $res;
if ($res["parent"] == 0) {
$result[$res['id']] = $res;
} else {
$result = getCategory($res["parent"]);
}
// print_r($result);
return $result;
}
开发者ID:progervlad,项目名称:utils,代码行数:15,代码来源:subs.php
示例19: category
function category()
{
if (empty($_GET['cid'])) {
return "Access Deny";
}
//Error::dbd();
$this->common();
$tplname = strtolower($this->app) . '_list.html';
$cate_id = (int) $_GET['cid'];
$cate = getCategory($cate_id);
if (empty($cate)) {
Swoole_js::js_back('不存在的分类!', '/index.php');
exit;
}
if (!empty($cate['uptime']) and Swoole\Tool::httpExpire($cate['uptime']) === false) {
exit;
}
if ($cate['fid'] == 0) {
$this->swoole->tpl->assign("fid", $cate_id);
$this->swoole->tpl->assign("ccate", $cate);
if ($cate['tplname']) {
$tplname = $cate['tplname'];
}
$gets['fid'] = $cate_id;
} else {
if ($cate['tplname']) {
$tplname = $cate['tplname'];
}
$this->swoole->tpl->assign("cate", $cate);
$ccate = $this->swoole->db->query("select * from st_catelog where id={$cate['fid']} limit 1")->fetch();
$this->swoole->tpl->assign("ccate", $ccate);
$gets['cid'] = $cate_id;
}
$pager = null;
$gets['order'] = 'addtime desc';
$gets['page'] = empty($_GET['page']) ? 1 : (int) $_GET['page'];
$gets['pagesize'] = empty($this->_model->pagesize) ? $this->swoole->config['cms']['pagesize'] : $this->_model->pagesize;
$gets['select'] = "id,title,addtime";
$list = $this->_model->gets($gets, $pager);
if ($this->swoole->config['cms']['html_static']) {
$pager->page_tpl = WEBROOT . "/{$this->app}/list_{$cate_id}_%s.html";
}
$pager = array('total' => $pager->total, 'render' => $pager->render());
$this->swoole->tpl->assign('pager', $pager);
$this->swoole->tpl->assign("list", $list);
$this->swoole->tpl->assign('cid', $cate_id);
$this->swoole->tpl->display($tplname);
}
开发者ID:netstao,项目名称:swoole.com,代码行数:48,代码来源:cms.php
示例20: parse
function parse()
{
$displayName = "Hoofdpagina";
//Fetch all from SQL.
$sql = "SELECT TOP 3 id,title,end_moment,start_bid,city FROM objects WHERE end_moment > GETDATE() ORDER BY end_moment ASC";
$result = $this->db->query($sql);
$soonEndingObjects = parseObjects($result);
$sql = "SELECT TOP 3 id,title,end_moment,start_bid,city FROM objects ORDER BY start_moment DESC";
$result = $this->db->query($sql);
$newObjects = parseObjects($result);
$categories = getCategory(array());
//$this->addToBreadcrumbs("Home");
$this->website->assign("categories", $categories);
$this->website->assign("newObjects", $newObjects);
$this->website->assign("soonEndingObjects", $soonEndingObjects);
$this->render($displayName, 'index.tpl');
}
开发者ID:K-4U,项目名称:Pr-IP-P2-02,代码行数:17,代码来源:index.php
注:本文中的getCategory函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论