ini_set("memory_limit","125M"); session_start(); session_destroy(); //this action to destroy eventual previous searches which are also stored in session and wouldnt get wiped. session_start(); require_once("classes/list/class_create_list.php"); require_once("classes/list/class_search.php"); ////////////////////////////////// // Initiate Search-class and instantiate search_book and search_object $categories=array("objects","books"); //,"books"); $objects=new Create_list("adlib_objecten.xml"); $objects->set_main_record('recordList'); $objects->make_list_searchable("search_objects.ini"); $books=new Create_list("adlib_boeken.xml"); $books->set_main_record('recordList'); $books->make_list_searchable("search_books.ini"); ////////////////////////////////// //INTRODUCE XAJAX require ('xajax/xajax.inc.php'); /////////////////////////////////// ////////////////////////////////// function decomp($str,$tok='@') { return explode($tok, $str); } ////////////////////////////////// //basic search function: initiate_search //define xajax search-function function initiate_search($string) { $ini=decomp($string); if (count($ini)===1) { global $categories; $type=$categories[0]; // for the first search $type is not defined } else $type=$ini[1]; /// if we do the search for the second or third type $string=$ini[0]; //!!make string safe $text="searching all $type, please wait..."; $objResponse = new xajaxResponse(); $objResponse->assign("searchresults_$type_init","innerHTML",$text); $objResponse->loadCommands(show_list("$string@$type@0")); return $objResponse; } // function continue_search($info_str) // //This function loops the search and orders to print the results. // { // list($string,$type,$currentPage) = decomp($info_str); // $dataset=$GLOBALS[$type]; // $dataset->search->find($string); // $dataset->search->create_print($type); // $objResponse = new xajaxResponse(); // $objResponse->loadCommands(show_list("$string@$type@0")); // // return $objResponse; // } ////////////////////////////////// function show_list($info_str) { list($string,$type,$currentpage) = decomp($info_str); $dataset=$GLOBALS[$type]; $dataset->search->find($string); $dataset->search->create_print($type); $R=$dataset->search->print_arr; $txt_open=array_shift($R); //R = array $txt_close=array_pop($R); $maxpages=count($R); $itemsppage=$dataset->search->getItemsPerPage(); //$currentpage=$dataset->search->getCurrentPage(); $loopnr=($itemsppage+$currentpage>$maxpages) ? $maxpages : $itemsppage+$currentpage; $text.=$txt_open; for ($i=$currentpage; $i<$loopnr;$i++) { $txt=$R[$i]; //print("txt: $txt \n"); if ($txt) $text.=$txt; } $link_text_prev="<< vorige";// (naar $previous2) prev2: $previous2 - next2: $next2"; $link_text_next="volgende >>";// (naar $next2)"; $text.="