ArticleHandler.class usage example

$currentCat  = $_REQUEST['cat'];
$categories  = new articleHandler($CATEGORIES_PATH) ;
...
// getting the breadcrumds
if(is_string($currentCat)){
$bread = $categories->get_breadCrumbs($currentCat);
for($i = count($bread)-1; $i >= 0; $i--){
if($i==O){
//this is the location the user is @, so no link has to be set
$t->set_var("currentone" , $bread[$i][0]);
}else{
//parse the breadcrumbs
$t->set_var("loc", $bread[$i][1]);
$t->set_var("tekst", $bread[$i][0]);
$t->parse("crumbs" , "bread", true);
}
}
}

//get items in a categorie
//1 stands for the field number being used
$itemsInCat = $items->searchFor($currentCat, 1);

//get subcategories of an categorie
//5 stands for the field number being used
$subCats = $categories->searchFor($currentCat, 5);

//adding an article without a photo
$items->add_art($cat, $csv);

//adding a product with a photo
$items->add_art($cat, $csv,$_FILES["_pic"]["tmp_name"]);

//deleting an article
$items->del_art(...);
...

//The same goes with categories

source

Leave a Reply