Return to Snippet

Revision: 1999
at December 11, 2006 10:06 by pietervp


Updated Code
$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

Revision: 1998
at December 11, 2006 10:05 by pietervp


Updated Code
$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

Revision: 1997
at December 11, 2006 10:02 by pietervp


Initial Code
$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

Initial URL
http://www.pietervp.com

Initial Description
This is an example of how to use the articleHandler.class.php , this class can be found @ pietervp.com -> downloads

Initial Title
ArticleHandler.class usage example

Initial Tags
database, category, csv

Initial Language
PHP