'yachts', 'perPage' => '20', 'loadUploads' => true, 'allowSearch' => true, //'useSeoUrls' => true, 'orderBy' => $customOrderBy, )); if(!@$_REQUEST['destinations']){ $_REQUEST['destinations']=-1; } if(!@$_REQUEST['yacht_type']){ $_REQUEST['yacht_type']=-1; } if(!@$_REQUEST['charter_type']){ $_REQUEST['charter_type']=-1; } list($destinationsRecords, $destinationsMetaData) = getRecords(array( 'tableName' => 'destination_list', 'where' => "num=".intval(mysql_escape(@$_REQUEST['destinations'])), 'limit' => '1', 'allowSearch' => false, )); $destinationsRecord = @$destinationsRecords[0]; // get first record list($yacht_typeRecords, $yacht_typeMetaData) = getRecords(array( 'tableName' => 'yacht_type_list', 'where' => "num ='".mysql_escape(@$_REQUEST['yacht_type'])."'", 'limit' => '1', 'allowSearch' => false, )); $yacht_typeRecord = @$yacht_typeRecords[0]; // get first record list($charter_typeRecords, $charter_typeMetaData) = getRecords(array( 'tableName' => 'charter_type_list', 'where' => "num ='".mysql_escape(@$_REQUEST['charter_type'])."'", 'limit' => '1', 'allowSearch' => false, )); $charter_typeRecord = @$charter_typeRecords[0]; // get first record // load record from 'settings' list($settingsRecords, $settingsMetaData) = getRecords(array( 'tableName' => 'settings', 'where' => '', // load first record 'loadUploads' => true, 'allowSearch' => false, 'limit' => '1', )); $settingsRecord = @$settingsRecords[0]; // get first record $resultsText=""; if ($destinationsRecord && $yacht_typeRecord && $charter_typeRecord) { $resultsText.=$charter_typeRecord['charter_type'] . " " . $yacht_typeRecord['yacht_type'] . " for Charter in " . $destinationsRecord['destination']; } elseif ($destinationsRecord && $yacht_typeRecord) { $resultsText.=$yacht_typeRecord['yacht_type'] . " for Charter in " . $destinationsRecord['destination']; } elseif ($destinationsRecord && $charter_typeRecord) { $resultsText.=$charter_typeRecord['charter_type'] . " Charters in " . $destinationsRecord['destination']; } elseif ($yacht_typeRecord && $charter_typeRecord) { $resultsText.=$charter_typeRecord['charter_type'] . " " . $yacht_typeRecord['yacht_type'] . " for Charter"; } elseif ($destinationsRecord) { $resultsText.="Yachts for Charter in " . $destinationsRecord['destination']; } elseif ($yacht_typeRecord) { $resultsText.=$yacht_typeRecord['yacht_type'] . " for Charter"; } elseif ($charter_typeRecord) { $resultsText.=$charter_typeRecord['charter_type'] . " Yachts for Charter"; } elseif(@$_REQUEST['yacht_name_query,meta_description_query,intro_query,description_query']){ $resultsText.="Search Results for: " . $_REQUEST['yacht_name_query,meta_description_query,intro_query,description_query']; } #### // this function will determine what the URL is for each of the sorting links on the page // first click will give the order ASC // second click will give the order DESC // $sortingField options: rate, length, guests // usage: getSortingURL("rate"); function getSortingURL($sortingField) { // sorting for "rate" if ($sortingField == "rate") { // first click -> set order to ASC if ( @$_REQUEST['sort'] == "rateASC" ) { return array('param' => "sort=rateDESC", 'class' => "is-active sortdesc"); } // second click -> set order to DESC if ( @$_REQUEST['sort'] == "rateDESC" ) { return array('param' => "sort=rateASC", 'class' => "is-active sortasc"); } if ( !@$_REQUEST['sort'] || @$_REQUEST['sort'] ) { return array('param' => "sort=rateASC", 'class' => ""); } } // sorting for "length" if ($sortingField == "length") { // first click -> set order to ASC if ( @$_REQUEST['sort'] == "lengthASC" ) { return array('param' => "sort=lengthDESC", 'class' => "is-active sortdesc"); } // second click -> set order to DESC if ( @$_REQUEST['sort'] == "lengthDESC" ) { return array('param' => "sort=lengthASC", 'class' => "is-active sortasc"); } if ( !@$_REQUEST['sort'] || @$_REQUEST['sort'] ) { return array('param' => "sort=lengthASC", 'class' => ""); } } // sorting for "guests" if ($sortingField == "guests") { // first click -> set order to ASC if ( @$_REQUEST['sort'] == "guestsASC" ) { return array('param' => "sort=guestsDESC", 'class' => "is-active sortdesc"); } // second click -> set order to DESC if ( @$_REQUEST['sort'] == "guestsDESC" ) { return array('param' => "sort=guestsASC", 'class' => "is-active sortasc"); } if ( !@$_REQUEST['sort'] || @$_REQUEST['sort'] ) { return array('param' => "sort=guestsASC", 'class' => ""); } } return "?"; } function getCustomOrderBy($sort) { if (!@$sort) { return "yacht_name ASC"; } switch ($sort) { case "rateASC": return "CAST(rate_high_season AS UNSIGNED) ASC"; break; case "rateDESC": return "CAST(rate_high_season AS UNSIGNED) DESC"; break; case "lengthASC": return "yacht_length ASC"; break; case "lengthDESC": return "yacht_length DESC"; break; case "guestsASC": return "guests_max ASC"; break; case "guestsDESC": return "guests_max DESC"; break; } return ""; } include("includes/headers.php"); ?>