ArticleHandler.class usage example


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. $currentCat = $_REQUEST['cat'];
  2. $categories = new articleHandler($CATEGORIES_PATH) ;
  3. ...
  4. // getting the breadcrumds
  5. if(is_string($currentCat)){
  6. $bread = $categories->get_breadCrumbs($currentCat);
  7. for($i = count($bread)-1; $i >= 0; $i--){
  8. if($i==O){
  9. //this is the location the user is @, so no link has to be set
  10. $t->set_var("currentone" , $bread[$i][0]);
  11. }else{
  12. //parse the breadcrumbs
  13. $t->set_var("loc", $bread[$i][1]);
  14. $t->set_var("tekst", $bread[$i][0]);
  15. $t->parse("crumbs" , "bread", true);
  16. }
  17. }
  18. }
  19.  
  20. //get items in a categorie
  21. //1 stands for the field number being used
  22. $itemsInCat = $items->searchFor($currentCat, 1);
  23.  
  24. //get subcategories of an categorie
  25. //5 stands for the field number being used
  26. $subCats = $categories->searchFor($currentCat, 5);
  27.  
  28. //adding an article without a photo
  29. $items->add_art($cat, $csv);
  30.  
  31. //adding a product with a photo
  32. $items->add_art($cat, $csv,$_FILES["_pic"]["tmp_name"]);
  33.  
  34. //deleting an article
  35. $items->del_art(...);
  36. ...
  37.  
  38. //The same goes with categories

URL: http://www.pietervp.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.