本文整理汇总了PHP中category类的典型用法代码示例。如果您正苦于以下问题:PHP category类的具体用法?PHP category怎么用?PHP category使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了category类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parent_link
function parent_link($categ_id, $categ_see)
{
global $charset;
global $base_path;
global $thesaurus_categories_show_empty_categ;
if ($categ_see) {
$categ = $categ_see;
} else {
$categ = $categ_id;
}
$tcateg = new category($categ);
if ($thesaurus_categories_show_empty_categ) {
$visible = true;
} else {
$visible = false;
}
if ($_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["SEARCH_TYPE"] != "term_search" && $_SESSION["CURRENT"]) {
$no_rec_history = 1;
} else {
$no_rec_history = 0;
}
if ($tcateg->has_notices()) {
$link = "<a href='" . $base_path . "/catalog.php?categ=search&mode=1&aut_id={$categ}&etat=aut_search&aut_type=categ&no_rec_history={$no_rec_history}' target=_top><img src='{$base_path}/images/search.gif' border=0 align='absmiddle'></a>";
$visible = true;
}
$r = array("VISIBLE" => $visible, "LINK" => $link);
return $r;
}
示例2: categoryList
function categoryList()
{
$page = new page();
$categ = new category();
$get_list = $categ->getAllList();
$page->printCategories($get_list);
}
示例3: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$cat = new category();
$cat->category = \Input::get('categoryname');
$cat->save();
return \Redirect::route('catesite')->with('alert', 'Category created successfully!');
}
示例4: list_all
function list_all()
{
$c = new category();
$all = $c->get_all_categories();
foreach ($all as $cc) {
echo $cc->get_cname() . "<BR/>";
}
}
示例5: save
/**
* Saves an category into the database.
*
* @param \GamyGoody\Domain\category $category The category to save
*/
public function save(category $category)
{
$categoryData = array('cat_title' => $category->getTitle());
if ($category->getId()) {
// The category has already been saved : update it
$this->getDb()->update('category', $categoryData, array('cat_id' => $category->getId()));
} else {
// The category has never been saved : insert it
$this->getDb()->insert('category', $categoryData);
// Get the id of the newly created category and set it on the entity.
$id = $this->getDb()->lastInsertId();
$category->setId($id);
}
}
示例6: getAllCategories
public function getAllCategories()
{
$aCategories = array();
$oConnection = new connection();
$sSQL = "SELECT TypeID\n\t\tFROM tbproducttype";
$oResult = $oConnection->query($sSQL);
while ($aRow = $oConnection->fetch_array($oResult)) {
$oCategory = new category();
$oCategory->load($aRow["TypeID"]);
$aCategories[] = $oCategory;
}
$oConnection->close_connection();
return $aCategories;
}
示例7: categoryEdit
function categoryEdit()
{
$page = new page();
$categ = new category();
if (isset($_GET['cid']) and $_GET['cid'] != 0) {
$id = $_GET['cid'];
} else {
$id = 0;
}
$editthis = $categ->get($id);
$msg = $page->processCategory();
$get_all_categories = $categ->getAlltree($editthis['par_id']);
$page->printCategoryForm($get_all_categories, $editthis['name'], $id, $msg);
}
示例8: show_action
function show_action() {
$this->view->page=front::get('page')?front::get('page'):1;
$this->pagesize=config::get('list_pagesize');
$limit=(($this->view->page-1)*$this->pagesize).','.$this->pagesize;
$special=new special();
$this->view->special=$special->getrow('spid='.front::get('spid'));
$this->view->archive['title'] = $this->view->special['title'];
$this->view->pages=true;
$archive=new archive();
$archives=$archive->getrows('spid='.front::get('spid'),$limit);
foreach($archives as $order=>$arc) {
$archives[$order]['url']=archive::url($arc);
$archives[$order]['catname']=category::name($arc['catid']);
$archives[$order]['caturl']=category::url($arc['catid']);
$archives[$order]['adddate']= sdate($arc['adddate']);
$archives[$order]['stitle']= strip_tags($arc['title']);
}
$this->view->archives=$archives;
$this->view->record_count=$archive->rec_count('spid='.front::get('spid'));
front::$record_count=$this->view->record_count;
$this->view->spid=front::get('spid');
if (front::get('t') == 'wap') {
$this->out('wap/special_show.html');
return;
}
}
示例9: getInstance
public static function getInstance()
{
if (is_null(category::$instance)) {
category::$instance = new category();
}
return category::$instance;
}
示例10: select
static function select($name,$value,$data,$option=null) {
$select="<select id=\"$name\" name=\"$name\" $option>";
if (!isset($data[0]) &&@$data[0] != null) {
$select.="<option value=\"0\">请选择...</option>";
}
if (@$data[0] == null ||(isset($data[0]) &&!$data[0]))
unset($data[0]);
if($_GET['table'] == 'category'){
$category = category::getInstance();
$subids = $category->sons($_GET['id']);
}
if($_GET['table'] == 'type'){
$category = type::getInstance();
$subids = $category->sons($_GET['id']);
}
foreach ($data as $k=>$d) {
$select .= "<option value=\"$k\"";
if($k == $value){
$select .= ' selected ';
}else if(isset($_GET['id']) && ($_GET['table'] == 'category' || $_GET['table'] == 'type') && !preg_match('/htmlrule/is', $name)){
if($_GET['id'] == $k || in_array($k,$subids)){
$select .= ' disabled ';
}
}
$select .= ">$d</option>";
//$select.="<option value=\"$k\" ".($k == $value ?'selected': '').">$d</option>";
}
$select.="</select>";
return $select;
}
示例11: parent_link
function parent_link($categ_id, $categ_see)
{
global $charset;
global $base_path;
global $opac_show_empty_categ;
global $css;
global $msg;
if ($categ_see) {
$categ = $categ_see;
} else {
$categ = $categ_id;
}
//$tcateg = new category($categ);
if ($opac_show_empty_categ) {
$visible = true;
} else {
$visible = false;
}
if (category::has_notices($categ)) {
$link = "<a href='#' onClick=\"parent.parent.document.term_search_form.action='" . $base_path . "/index.php?lvl=categ_see&id={$categ}&rec_history=1'; parent.parent.document.term_search_form.submit(); return false;\" title='" . $msg["categ_see_alt"] . "'><img src='./images/search.gif' border=0 align='absmiddle'></a>";
$visible = true;
}
$r = array("VISIBLE" => $visible, "LINK" => $link);
return $r;
}
示例12: upload_thumb_action
function upload_thumb_action() {
$res=array();
$uploads=array();
if (is_array($_FILES)) {
$upload=new upload();
foreach ($_FILES as $name=>$file) {
if (!$file['name'] ||!preg_match('/\.(jpg|gif|png|bmp)$/',$file['name'])) {
continue;
}
$uploads[$name]=$upload->run($file);
if (empty($uploads[$name])) {
$res['error']=$name.lang('上传失败!');
break;
}
$res[$name]['name']=$uploads[$name];
$path=$upload->save_path;
chmod($path,0644);
$thumb=new thumb();
$thumb->set($path,'file');
$catid=get('catid');
$type=get('type');
if ($catid)
$thumb->create($path,category::getwidthofthumb($catid),category::getheightofthumb($catid));
else
$thumb->create($path,config::get('thumb_width'),config::get('thumb_height'));
$_name=str_replace('_upload','',$name);
$res[$name]['code']="
document.form1.$_name.value=data[key].name;
image_preview('$_name',data[key].name);
";
}
}
echo json::encode($res);
}
示例13: Index
public function Index()
{
$nva = M('category')->select();
$cate = category::zifenleis($nva);
$this->assign('cate', $cate);
S('index', $cate, 10);
$this->display('Widget:Cate');
}
示例14: ctsitemap_action
function ctsitemap_action(){
$category = category::getInstance();
$category->sitemap();
front::flash('生成网站地图成功');
front::redirect(front::$from);
/*echo "<script>alert('生成网站地图成功!');window.close();</script>";
exit;*/
}
示例15: categories_list
function categories_list($data = '')
{
$output = '
<table bgcolor="' . COLOR_TABLE_GENERAL . '">
';
$query = "SELECT * FROM `categories` WHERE `deleted`='0' ORDER BY id ASC";
$res = common_query($query, __FILE__, __LINE__);
if (!$res) {
return '';
}
$i = 0;
while ($arr = mysql_fetch_array($res)) {
$i++;
$catid = $arr['id'];
$cat = new category($catid);
$name = ucfirst($cat->name($_SESSION['language']));
$backcommand = "order_create1";
$bgcolor = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'categories', 'htmlcolor', $catid);
$link = 'orders.php?command=dish_list&data[category]=' . $catid;
if (isset($data['quantity']) && $data['quantity']) {
$link .= '&data[quantity]=' . $data['quantity'];
}
if (isset($data['priority']) && $data['priority']) {
$link .= '&data[priority]=' . $data['priority'];
}
if ($i % 2) {
$output .= '
<tr>';
}
$output .= '
<td bgcolor="' . $bgcolor . '" onclick="redir(\'' . $link . '\');return(false);">
<a href="' . $link . '">
<strong>' . $name . '</strong>
</a>
</td>';
if (($i + 1) % 2) {
$output .= '
</tr>';
}
}
$output .= '
</tbody>
</table>';
return $output;
}