public function itemsByCat($catId) { session_start(); $data['activeLink'] = 2; $this->load->view('main_top', $data); $productsStuff = new ProductsStuff(); $stuff = $productsStuff->getProducts(NULL, $catId, 0, 100); $data['stuff'] = $stuff; $_SESSION['currentStuff'] = $stuff; $data['catId'] = $catId; $this->load->view('itemsByCat', $data); $this->load->view('main_footer'); }
public function index() { // Exmaple of using products stuff // $productsStuff = new ProductsStuff(); // $productsStuff->getProducts(NULL, -1, 0, 100); // Example of using news stuff // $newsStuff = new NewsStuff(); // $newsStuff->getNews(NULL, 0, 100); session_start(); $id = -1; $data['activeLink'] = $id; $this->load->view('main_top', $data); $productsStuff = new ProductsStuff(); $stuff = $productsStuff->getProducts(NULL, -1, 0, 100); $data['stuff'] = $stuff; $_SESSION['currentStuff'] = $stuff; $this->load->view('scroll', $data); $this->load->view('main_footer'); }
$product = new ProductInfo(); if (is_uploaded_file($_FILES["foto"]["tmp_name"])) { $upfile = getcwd() . "\\images\\items\\" . basename($_FILES["foto"]["name"]); $product->setImageUrl($_FILES["foto"]["name"]); move_uploaded_file($_FILES["foto"]["tmp_name"], $upfile); } else { echo "Error =("; } if (is_uploaded_file($_FILES["prefoto"]["tmp_name"])) { $upfile = getcwd() . "\\images\\items\\preview_" . basename($_FILES["prefoto"]["name"]); move_uploaded_file($_FILES["prefoto"]["tmp_name"], $upfile); } else { echo "Error =("; } $product->name = $_POST['fName']; $product->category = categoryById($cats, $_POST['fCat']); $product->description = $_POST['fText']; $product->price = $_POST['fPrice']; $ch_sizes = $_POST['fSizes']; foreach ($ch_sizes as $size) { $sizeInfo = sizeById($sizes, $size); $product->sizes[$sizeInfo->id] = $sizeInfo; } $productStuff->addProduct($product); $_SESSION['currentStuff'] = $productStuff->getProducts(NULL, -1, 0, 100); header("Location: /index.php/items/"); } ?> </form> </div><!-- #content-->