assign("PAGE",$page);//assigned template variable PAGE ###################### END OF PAGINATION DATA ########################################### $sort_fields = array( "sku" => "sku", "title" => "title", "date_added" => "date added" ); define("URL","http://www.ktimatoemporiki.gr/web-services/"); $cat = ($_POST['cat']) ? $_POST['cat'] : $_GET['cat']; $sl = ($_GET['sl']) ? $_GET['sl'] : DEFAULT_LANG; $file = URL."get_location.php?cat=$cat&page=$page&sl=$sl"; $default_sort = "date_added"; $default_direction = 1; //Check if the sort field passed is valid $var = array_flip ($sort_fields); $result = in_array($_GET['sort'], $var, TRUE); $sort = ($result == 1) ? $_GET['sort'] : $default_sort; //End check $direction = ($_GET['sort_direction']) ? $_GET['sort_direction'] : $default_direction; $selected = ($_GET['sort']) ? $sort : $default_sort; //If user submited a sort direction process it $order_by = ($direction == 1) ? "desc" : "asc"; $xml = xmlize(remote_connection($file,0)); # where $data is the xml in the above section. $decoding_array = array("description","full_description","image"); $navigation = create_array("categories","navigation",$xml); $list = create_array("categories","list",$xml); $smarty->assign("file","location"); $smarty->assign("cat",$cat); $smarty->assign("categories",create_array("categories","cat",$xml));//MENU $smarty->assign("nav",create_array("categories","nav",$xml));//MENU $smarty->assign("subs",create_array("categories","sub",$xml)); $smarty->assign("products",create_array("categories","prod",$xml,$decoding_array)); $smarty->assign("list",$list[0]); $smarty->assign("num_links",create_array("categories","num_links",$xml)); $smarty->assign("navigation",$navigation[0]); $smarty->assign("COLS",1); $smarty->assign("include_file","category.tpl"); $smarty->display("home.tpl"); ?>