本文整理汇总了PHP中CategoryModel::getCategoryPathById方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryModel::getCategoryPathById方法的具体用法?PHP CategoryModel::getCategoryPathById怎么用?PHP CategoryModel::getCategoryPathById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CategoryModel
的用法示例。
在下文中一共展示了CategoryModel::getCategoryPathById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content_52661634228078_50365984
function content_52661634228078_50365984($_smarty_tpl)
{
echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
?>
<script type="text/javascript" src="./js/cate.js"></script>
<div class="fourvar">
<div class="pathvar">
<?php
echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
?>
</div>
<div class="texvar">
</div>
<div class="pagination">
<?php
echo $_smarty_tpl->tpl_vars['show_page']->value;
?>
</div>
</div>
<div class="servar products-servar">
<span>
<a href="index.php?mod=category&act=addCategory">增加类别</a>
</span>
<span style="color: red;" id="error"><?php
echo $_GET['status'];
?>
</span>
</div>
<div class="main feedback-main">
<table class="products-action" cellspacing="0" width="100%">
<tr class="title">
<td>编号</td>
<td>名称</td>
<td>所属类级</td>
<td>父类</td>
<td>操作</td>
</tr>
<?php
$_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
$_smarty_tpl->tpl_vars['value']->_loop = false;
$_from = $_smarty_tpl->tpl_vars['categoryList']->value;
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
$_smarty_tpl->tpl_vars['value']->_loop = true;
?>
<tr class="odd" id="<?php
echo $_smarty_tpl->tpl_vars['value']->value['id'];
?>
">
<td><?php
echo $_smarty_tpl->tpl_vars['value']->value['id'];
?>
</td>
<td><?php
echo $_smarty_tpl->tpl_vars['value']->value['name'];
?>
</td>
<td><?php
echo $_smarty_tpl->tpl_vars['value']->value['file'];
?>
</td>
<td><?php
echo getAllCateNameByPath(CategoryModel::getCategoryPathById($_smarty_tpl->tpl_vars['value']->value['pid']));
?>
</td>
<td>
<input type="button" value="修改" tid="<?php
echo $_smarty_tpl->tpl_vars['value']->value['id'];
?>
" class="mod"/>
<input type="button" value="删除" tid="<?php
echo $_smarty_tpl->tpl_vars['value']->value['id'];
?>
" class="del"/>
</td>
</tr>
<?php
}
?>
</table>
</div>
<div class="bottomvar">
<div class="texvar">
</div>
<div class="pagination">
<?php
echo $_smarty_tpl->tpl_vars['show_page']->value;
?>
</div>
</div>
<?php
echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
}
开发者ID:ohjack,项目名称:newErp,代码行数:100,代码来源:8a72e1cdc1706fbbc0eed0ae0a968d99c4a44659.file.categoryList.htm.php
示例2: act_addInput
function act_addInput()
{
//$pidNew = $_POST['pidNew']?post_check($_POST['pidNew']):'';//类别
$finalIdArr = $_POST['finalIdStr'];
//新建属性-类别4
$inputName = $_POST['inputName'] ? post_check($_POST['inputName']) : '';
//类别
$textStatus = $_POST['textStatus'] ? post_check($_POST['textStatus']) : '';
//文本方式
if (empty($finalIdArr) || empty($inputName)) {
self::$errCode = 101;
self::$errMsg = '类别或属性名不能为空';
return false;
}
if (intval($textStatus) <= 0) {
self::$errCode = 102;
self::$errMsg = '文本方式有误';
return false;
}
$tmpArr = array();
if (!is_array($finalIdArr)) {
$tmpArr[] = $finalIdArr;
$finalIdArr = $tmpArr;
}
$finalPathArr = array();
foreach ($finalIdArr as $cid) {
$catePath = CategoryModel::getCategoryPathById($cid);
if (empty($catePath)) {
self::$errCode = 109;
self::$errMsg = '类别有误';
return false;
}
$finalPathArr[] = $catePath;
}
$tName = 'pc_goods_category';
foreach ($finalPathArr as $value) {
$where = "WHERE path like'%{$value}-%' and is_delete=0";
$count = OmAvailableModel::getTNameCount($tName, $where);
if ($count) {
self::$errCode = 105;
self::$errMsg = '只能在最小分类进行复制';
return false;
}
}
try {
$pidNewStr = '';
BaseModel::begin();
$tName = 'pc_archive_input';
foreach ($finalPathArr as $value) {
$where = "WHERE inputName='{$inputName}' AND categoryPath='{$value}'";
$countIN = OmAvailableModel::getTNameCount($tName, $where);
if (!$countIN) {
$pidNewStr .= CategoryModel::getCategoryNameByPath($value) . ' ';
$set = "SET inputName='{$inputName}',categoryPath='{$value}',textStatus='{$textStatus}'";
OmAvailableModel::addTNameRow($tName, $set);
}
}
BaseModel::commit();
BaseModel::autoCommit();
self::$errCode = 200;
self::$errMsg = "{$inputName} 添加到 {$pidNewStr} 成功";
return true;
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
self::$errCode = 201;
self::$errMsg = $e->getMessage();
return false;
}
}