DB table t_catalog:

id model_id model_year 80 394 2013 php function catalogQuickSearch(){ $tpl = $this->templates->tplRead("catalogQuickSearch.html"); $arr = array( 'catalogQuickSearch_title' => CATALOG_QUICK_SEARCH_TITLE, 'catalogQuickSearch_help' => CATALOG_QUICK_SEARCH_HELP, 'catalogQuickSearch_example' => CATALOG_QUICK_SEARCH_EXAMPLE, 'catalogQuickSearch_primer' => CATALOG_QUICK_SEARCH_PRIMER, '_example_car' => $this->spec->modelName(3), ); $tpl = $this->templates->tplReplace($tpl, $arr); $content = $tpl; return $content; } ХТМЛ <h4>{catalogQuickSearch_title}</h4> <form id="search" action="index.php"> <input type="hidden" name="mod" value="models" /> <input type="hidden" name="cmd" value="details" /> <div class="catalogQSQuery"><input type="text" name="q" id="q" onblur="if($(this).val() == '')$(this).val('{catalogQuickSearch_help}');" onclick="if($(this).val() == '{catalogQuickSearch_help}')$(this).val('');" value="{catalogQuickSearch_help}" autocomplete="off" onkeyup="suggestion('catalogUI', $(this));" /></div> <div class="catalogQSSubmit"><input type="image" src="templates/images-v2/searchBtn.gif" /><br /></div> <div class="clear"><!-- --></div> </form> <div class="catalogQSExample">{catalogQuickSearch_example}: {catalogQuickSearch_primer} <a onclick="$('#q').val($(this).text()); $('#search').submit(); return false;" href="#">{_example_car}</a></div> 

Search generates another: http://www.site/index.php?mod=models&cmd=details&q=2014+Jeep+Grand+Cherokee+%272714&x=28&y=14

Question : How to rewrite (add) the code so that the search generates the URL of such a plan: http://www.site/models/jeep/grand-cherokee-14/2014 ?

I clarify There is a feature output popular cars. But it displays popular cars in the list (table) - 15 pcs. And I need to find among these popular cars 1 auto specified in the search ...

 Как это сделать, кто знает прошу помочь? function catalogPopular(){ $sql = "SELECT ".$this->catalogTable.".*, ".$this->defaultTable.".parent_id AS maker_id FROM ".$this->defaultTable.", ".$this->catalogTable." WHERE ".$this->defaultTable.".id = ".$this->catalogTable.".model_id AND ".$this->catalogTable.".status = '1' AND ".$this->catalogTable.".pinned = '1' ORDER BY date_post DESC LIMIT 15 "; $DBres = $this->dataBase->execQuery($sql); if(!$this->dataBase->getRowNums($DBres)) return ''; $tpl = $this->templates->tplRead("catalogPopular.html"); $arr = array( 'catalogPopular_title' => CATALOG_POPULAR_TITLE, ); $tpl = $this->templates->tplReplace($tpl, $arr); $tempTd1 = $this->templates->tplGetLoop($tpl, 'td1'); if($DBres) foreach($this->dataBase->loadObjects($DBres) as $val){ $arr = array( '_car_title' => $this->spec->modelName($val->id), '_car_url' => $this->spec->modelURL($val->id), ); $allTd1 .= $this->templates->tplReplace($tempTd1, $arr); } $content .= $tpl = $this->templates->tplPutLoop($tpl, 'td1', $allTd1); return $content; } } 
  • URL of such a site / models / jeep / grand-cherokee-14/2014 plan should also be processed, and this question is much more complicated - Valentin Zhukov
  • Let's work together ... - Greg888
  • Either redirect through js, or redirect on the script-receiver of the form. The form itself will never generate this. - etki
  • Fike Please help based on my clarification in the question ... - Greg888

0