Хочу сделать так. Выдернуть код из расширенного поиска файл search.html.php, там работают зависимые списки. В моем случае это город, район, микрорайон. И вставить его в быстрый поиск horiz.php. Вставлял код по разному, но не работает. Что то делаю Неправильно. Помогите пожалуйста если кто знает.
Код файла search.html.php
<?php
/*
File: search.html.php
EstateAgent Improved Component for Joomla 1.5.x
Version: 1.5.x
Author: EAImproved team
Homepage:
http://www.eaimproved.euLicense: GNU/GPL
http://www.gnu.org/copyleft/gpl.html*/
defined('_JEXEC') or die('Restricted access');
class HTML_estateagent_search{
function showsearchform($map,$countries,$countrynames,$states,$towns,$districts,$lists){
$eaconf=&EAConfig::getInstance();
$eahelper=&EA_Helper::getInstance();
$document=& JFactory::getDocument();
//$categories_list=EAHTML::catSelectList('src_cat', 'class="inputbox" style="width: 140px" ');
//$typelist=EAHTML::type_select_list('type', 'class="inputbox" style="width: 140px" ');
//$agent=EAHTML::agent_select_list('agent', 'class="inputbox" style="width: 140px" ');
if($eaconf->ea_location_srch){
if(count($map)==0 && $eaconf->ea_extend_srch == 0 && $eaconf->ea_equipment_srch == 0) { ?>
<div style="margin:4px; padding:2px; width:99%; text-align:center"><?php echo JText::_('EA_SRCH_NOENTRIES');?></div>
<?php }
else{?>
<?php
# generate javascript-array of countries --------------------
$c="";
$c .= "Countries = new Array();\n";
$c .= "Countrynames = new Array();\n";
$x = 0;
foreach($countries as $country) {
$c .= "Countries[".$x."] = \"".$country."\";\n";
$c .= "Countrynames[".$x."] = \"".$countrynames[$x]."\";\n";
$x++;
}
$document->addScriptDeclaration($c);?>
<?php
//=== if step by step generate javascript-arrays
if($eaconf->ea_loc_srch_type == 0){
$js = "var noselected = '".JText::_('EA_NOT_SELECTED')."';";
$document->addScriptDeclaration($js);
$script="";
$document->addScript('components/com_estateagent/assets/js/search.js');
# generate javascript-array of states -----------------------
$script .= "States = new Array();\n";
for($country=0;$country<count($countries);$country++) {
$script .= "States[".$country."] = new Array();\n";
for($state=0;$state<count($states[$country]);$state++) {
$script .= "States[".$country."][".$state."] = \"".$states[$country][$state]."\";\n";
}
}
?>
<?php
# generate javascript-array of districts ------------------------
$script .= "Districts = new Array();";
for($country=0;$country<count($countries);$country++) {
$script .= "Districts[".$country."] = new Array();\n";
for($state=0;$state<count($states[$country]);$state++) {
$script .= "Districts[".$country."][".$state."] = new Array();\n";
for($district=0;$district<count($districts[$country][$state]);$district++) {
$script .= "Districts[".$country."][".$state."][".$district."] = \"".$districts[$country][$state][$district]."\";\n";
}
}
}
# Generate JavaScript-Array of towns
$script .= "Towns = new Array();\n";
for($country=0;$country<count($countries);$country++) {
$script .= "Towns[".$country."] = new Array();\n";
for($state=0;$state<count($states[$country]);$state++) {
$script .= "Towns[".$country."][".$state."] = new Array();\n";
for($district=0;$district<count($districts[$country][$state]);$district++) {
$script .= "Towns[".$country."][".$state."][".$district."] = new Array();\n";
for($town=0;$town<count($towns[$country][$state][$district]);$town++) {
$script .= "Towns[".$country."][".$state."][".$district."][".$town."] = \"".$towns[$country][$state][$district][$town]."\";\n";
}
}
}
}
$document->addScriptDeclaration($script);
}
}
}
?>
<form action="<?php echo JRoute::_("index.php?option=com_estateagent&view=dosearch");?>" method="post" onsubmit="javascript: validate();" id="easearch" name="easearch" >
<?php
if ($eaconf->ea_category_srch || $eaconf->ea_keyword_srch || $eaconf->ea_type_srch || $eaconf->ea_price_srch){
echo "<fieldset>";
//Free Search -----------------------------------------------------------------------------
if ($eaconf->ea_keyword_srch) echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_SRCH_FREE')."</label><input class=\"inputbox\" type=\"text\" name=\"searchstring\" maxlength=\"100\" style=\"width:140px;\"/></div>";
//Category Search -----------------------------------------------------------------------------
if ($eaconf->ea_category_srch) echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_CAT_OVW')."</label>".$lists['categories']."</div>";
//Type Search -----------------------------------------------------------------------------
if ($eaconf->ea_type_srch) echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_SRCH_TYPE')."</label>".$lists['types']."</div>";
if ($eaconf->ea_agent_srch) echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_SRCH_AGENT')."</label>".$lists['agents']."</div>";
//Price Search -----------------------------------------------------------------------------
if ($eaconf->ea_price_srch){
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_SRCH_PRICE_FROM')."</label>".$lists['minvalue']."</div>";
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_SRCH_PRICE_TO')."</label>".$lists['maxvalue']."</div>";
}
echo "</fieldset>";
}
//ea_loc_srch_type 0= step by step 1=free
//Location Search -----------------------------------------------------------------------------
?>
<?php if($eaconf->ea_location_srch) { ?>
<fieldset><legend><?php echo JText::_('EA_SRCH_PART_LCN');?></legend>
<?php
// Search in Countries Страна-----------------------------------------------------------------------
$countrylist[] = JHTML::_('select.option', 'no', JText::_('EA_NOT_SELECTED'));
$x=0;
foreach($countries as $c){
$countrylist[] = JHTML::_('select.option', $c ,JText::_($countrynames[$x]));
$x++;
}
$js = $eaconf->ea_loc_srch_type==0 ? ' onchange="setStates(this.selectedIndex-1)" ':'';
$countrys = JHTML::_('select.genericlist', $countrylist,'src_country',' class="inputbox" style="width:140px" '.$js, 'value', 'text','0' );
$label = $eaconf->ea_loc_srch_type==0 ? "<b>".JText::_('EA_SRCH_STEP')."</b> 1: ".JText::_('EA_OBJ_COUNTRY'):JText::_('EA_OBJ_COUNTRY');
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".$label."</label>".$countrys."</div>";
// Search in States Город-----------------------------------------------------------------------
$statelist[] = JHTML::_('select.option', 'no', JText::_('EA_NOT_SELECTED'));
foreach($lists['stateslist'] as $s){
$statelist[] = JHTML::_('select.option', $s ,JText::_($s));
}
$js = $eaconf->ea_loc_srch_type==0 ? ' onchange="setDistricts(this.selectedIndex-1)" ':'';
$thestates = JHTML::_('select.genericlist', $statelist,'src_state',' class="inputbox" style="width:140px" '.$js, 'value', 'text','0' );
$label = $eaconf->ea_loc_srch_type==0 ? "<b>".JText::_('EA_SRCH_STEP')."</b> 2: ".JText::_('EA_OBJ_STATE'):JText::_('EA_OBJ_STATE');
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".$label."</label>".$thestates."</div>";
// Search in Districts Район-----------------------------------------------------------------------
$districtlist[] = JHTML::_('select.option', 'no',JText::_('EA_NOT_SELECTED'));
foreach($lists['districtslist'] as $dist){
$districtlist[] = JHTML::_('select.option', $dist ,JText::_($dist));
}
$js = $eaconf->ea_loc_srch_type==0 ? ' onchange="setTowns(this.selectedIndex-1)" ':'';
$thedistrict = JHTML::_('select.genericlist', $districtlist,'src_district',' class="inputbox" style="width:140px" '.$js, 'value', 'text','0' );
$label = $eaconf->ea_loc_srch_type==0 ? "<b>".JText::_('EA_SRCH_STEP')."</b> 3: ".JText::_('EA_OBJ_DISTRICT'):JText::_('EA_OBJ_DISTRICT');
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".$label."</label>".$thedistrict."</div>";
// Search in TownsМикрорайон-----------------------------------------------------------------------
$townlist[] = JHTML::_('select.option', 'no',JText::_('EA_NOT_SELECTED'));
foreach($lists['townslist'] as $town){
$townlist[] = JHTML::_('select.option', $town ,JText::_($town));
}
$towns = JHTML::_('select.genericlist', $townlist,'src_town',' class="inputbox" style="width:140px" ', 'value', 'text','0' );
$label = $eaconf->ea_loc_srch_type==0 ? "<b>".JText::_('EA_SRCH_STEP')."</b> 4: ".JText::_('EA_OBJ_TOWN'):JText::_('EA_OBJ_TOWN');
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".$label."</label>".$towns."</div>";
?>
<br/>
<?php
// Search in PostCodeПочтовый---------------------------------------------------------------------------
$pclist[] = JHTML::_('select.option', 'no',JText::_('EA_NOT_SELECTED'));
foreach($lists['pcodelist'] as $pc){
$pclist[] = JHTML::_('select.option', $pc ,JText::_($pc));
}
$post_codes= JHTML::_('select.genericlist', $pclist,'src_pc',' class="inputbox" style="width:140px" ', 'value', 'text','0' );
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_OBJ_PCODE')."</label>".$post_codes."</div>";
?>
</fieldset>
<?php
}
//---Конец поиска до почтового кода------------------------------------------------------------------------
if($eaconf->ea_extend_srch) {
echo "<fieldset><legend>".JText::_('EA_SRCH_PART_EXT')."</legend>";
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_OBJ_DWSPACE')."</label>".$lists['livingspace']."</div>";
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_OBJ_YOBUILT')."</label>".$lists['yofbuild']."</div>";
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_OBJ_ROOMNR')."</label>".$lists['rooms']."</div>";
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_OBJ_BEDROOMS')."</label>".$lists['bedrooms']."</div>";
echo "<div class=\"ea_sf_container\"><label class=\"ea_sf_label\">".JText::_('EA_OBJ_WC')."</label>".$lists['bathrooms']."</div>";
echo "</fieldset>";
}
//-----------------------------------------------------------------------
if($eaconf->ea_equipment_srch) {
echo "<fieldset><legend>".JText::_('EA_SRCH_EQUPMT_DETAILS')."</legend>";
//echo $ed;
echo $lists['equipment'];
echo "</fieldset>";
}
echo "<div class=\"ea_sf_button\" style=\"text-align:center\"><input class=\"button\" type=\"submit\" value=\"".JText::_('EA_SRCH_BTT_SEARCH')."\" /></div>";
echo "</form>";
}
//Карта похоже====================================================================================
function show_result($results,$pageNav){
$mainframe = & JFactory::getApplication();
$my =& JFactory::getUser();
$eaconf=& EAConfig::getInstance();
$total=count($results);
// show search result
//if($total > 0) $mainframe->enqueueMessage(JText::_('EA_SRCH_RESULTS1')." ". $pageNav->total . " ".JText::_('EA_SRCH_RESULTS2'));
//$eaconf = &EAConfig::getInstance();
//$width = ea_googlemap_width;
//$height = $eaconf->ea_googlemap_height;
if ($total>0)
{
//===========================Map view multi point
if (($eaconf->ea_search_result_layout==1 || $eaconf->ea_search_result_layout==0) && ($eaconf->ea_googlemap_enable==1)){
echo EA_helper::MapListings($results,'serchresults');
}
//==========================
//====List view
if (($eaconf->ea_search_result_layout==2 || $eaconf->ea_search_result_layout==0) || $eaconf->ea_googlemap_enable==0 ){
$mainframe->enqueueMessage(JText::_('EA_SRCH_RESULTS1')." ". $pageNav->total . " ".JText::_('EA_SRCH_RESULTS2'));
if($total >1) echo HTML_ordering_estateagent::OrderingBar($pageNav);
echo"<div class=\"ea_pagenav_container\">".$pageNav->getResultsCounter()."</div>";
$line=1;
foreach($results as $obj) {
show_Object_short($obj, $line, $total);
$line++;
}
echo "<div class=\"ea_pagenav_container\">";
echo $pageNav->getPagesLinks();
echo "<br/>";
echo $pageNav->getPagesCounter();
echo "</div>";
}
}
else
{
echo "<div style=\"text-align:center; margin:4px\"><br/>";
echo JText::_('EA_SRCH_NORESULT')."<br/>";
echo"<a href=\"javascript:history.go(-1)\">".JText::_('Go Back')."</a>";
echo "</div>";
}
}
}
И код файла horiz.php
<?php
/* **************************************************************************
Module: Quick search for EstateAgent Improved Component v 1.5.x
Version: 1.5.x
Author: EAImproved team
Homepage:
http://www.eaimproved.euLicense: GNU/GPL
http://www.gnu.org/copyleft/gpl.html/* **************************************************************************/
defined('_JEXEC') or die('Restricted access');
$link = JRoute::_( 'index.php?option=com_estateagent&view=easearch');
?>
<?php if($params->get('showcat')==1 || $params->get('showtype')==1 || $params->get('livingspace')==1 || $params->get('yearOfconstr')==1 || $params->get('rooms')==1 || $params->get('bedrooms')==1 || $params->get('showtextbox')==1 || $params->get('showprice')==1 || $params->get('showcountry')==1 || $params->get('showstates')==1 || $params->get('showdistrict')==1 || $params->get('showtown')==1) { ?>
<fieldset>
<form action="<?php echo JRoute::_('index.php?option=com_estateagent&view=dosearch')?>" method="post" name="easearch_mod">
<?php
echo "<ul id=\"display-inline\">";
//--------location search Здесь код разметки быстрого поиска
if($params->get('showcountry')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"modeasearch_src_country\">".JText::_('EA_OBJ_COUNTRY')."</label>";
echo $lists['countries'];
echo "</li>";
}
if($params->get('showstates')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"modeasearch_src_state\">".JText::_('EA_OBJ_STATE')."</label>";
echo $lists['states'];
echo "</li>";
}
if($params->get('showdistrict')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"modeasearch_src_district\">".JText::_('EA_OBJ_DISTRICT')."</label>";
echo $lists['district'];
echo "</li>";
}
if($params->get('showtown')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"modeasearch_src_town\">".JText::_('EA_OBJ_TOWN')."</label>";
echo $lists['towns'];
echo "</li>";
}
//-------------------------------
if ($params->get('showtype')==1) {
echo "<li>";
echo "<label for=\"modsearch_type\" class=\"ea_hor_label\">".JText::_('EA_SRCH_TYPE')."</label>";
echo $lists['types'];
echo "</li>";
}
if($params->get('showcat')==1){
echo "<li>";
echo "<label for=\"modeasearch_src_cat\" class=\"ea_hor_label\">".JText::_('EA_CAT_OVW')."</label>";
echo $lists['categories'];
echo "</li>";
}
if ($params->get('showagents')==1) {
echo "<li>";
echo "<label class=\"easm_label\" for=\"modsearch_agents\">".JText::_('EA_SRCH_AGENT')."</label>";
echo $lists['agents'];
echo "</li>";
}
if($params->get('livingspace')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"mod_space\">".JText::_('EA_OBJ_DWSPACE')."</label>";
echo $lists['livingspace'];
echo "</li>";
}
if($params->get('yearOfconstr')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"mod_yobuilt\">".JText::_('EA_OBJ_YOBUILT')."</label>";
echo $lists['yofbuild'];
echo "</li>";
}
if($params->get('rooms')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"mod_rooms\">".JText::_('EA_OBJ_ROOMNR')."</label>";
echo $lists['rooms'];
echo "</li>";
}
if($params->get('bedrooms')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"mod_bedrooms\">".JText::_('EA_OBJ_BEDROOMS')."</label>";
echo $lists['bedrooms'];
echo "</li>";
}
if($params->get('wc')==1){
echo "<li>";
echo "<label class=\"ea_hor_label\" for=\"mod_wc\">".JText::_('EA_OBJ_WC')."</label>";
echo $lists['bathrooms'];
echo "</li>";
}
if($params->get('showprice')==1){
echo "<li>";
echo "<label for=\"modeasearch_minvalue\" class=\"ea_hor_label\">".JText::_('EA_SRCH_PRICE_FROM')." ".$eaconf->ea_currency."</label>";
echo $lists['minvalue'];
echo "</li>";
echo "<li>";
echo "<label for=\"modeasearch_maxvalue\" class=\"ea_hor_label\">".JText::_('EA_SRCH_PRICE_TO')." ".$eaconf->ea_currency."</label>";
echo $lists['maxvalue'];
echo "</li>";
}
if($params->get('showtextbox')==1){
echo "<li>";
echo "<label for=\"searchstring\" class=\"ea_hor_label\">".JText::_('EA_SRCH_FREE')."</label>";
echo "<input class=\"inputbox\" type=\"text\" id=\"searchstring\" name=\"searchstring\" maxlength=\"100\" style=\"width:".$textboxwidth."px\"/>";
echo "</li>";
}
echo "<li style=\"text-align:center;\">";
if ($params->get('show_advsearch')==1) {
echo "<a href=\"".$link."\">".JText::_('EA_SRCH_ADVANCE')."</a>"."<br/>"."<br/>";
}
echo "<input class=\"button\" type=\"submit\" value=\"".JText::_('EA_SRCH_BTT_SEARCH')."\" />";
echo "</li>";
echo "</ul>";
?>
</form>
</fieldset>
<?php
}?>