8711 sujets

Développement web côté serveur, CMS

Bonjour,
Je cherche à faire un formulaire multi-recherche pour mon site.
Mais j'ai un peu du mal, cela ne fonctionne pas. Car j'ai plusieurs fois la même variable. Pour info, c'est sur wordpress.

Voici mon code, merci pour votre aide.
<form action="<?php bloginfo('url'); ?>" method="get" id="searchform" class="form_search">

					<div class="searchfield">
						<input name="s" type="text" id="s" tabindex="1" class="editbox_search" style="width:320px" <?php if ( get_search_query() ) { echo 'value="'.trim(strip_tags(esc_attr(get_search_query()))).'"'; } else { ?> value="<?php _e('What are you looking for?','appthemes'); ?>" onfocus="if (this.value == '<?php _e('What are you looking for?','appthemes'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('What are you looking for?','appthemes'); ?>';}" <?php } ?> />
					</div>

					<div class="searchbutcat">

						<?php wp_dropdown_categories('show_option_all='.__('Type d\'hébergement', 'appthemes').'&hierarchical='.get_option('cp_cat_hierarchy').'&hide_empty='.get_option('cp_cat_hide_empty').'&depth='.get_option('cp_search_depth').'&show_count='.get_option('cp_cat_child_count').'&orderby='.get_option('cp_cat_orderby').'&title_li=&use_desc_for_title=1&tab_index=2&name=scat&selected='.cp_get_search_catid().'&class=searchbar&taxonomy='.APP_TAX_CAT); ?>
						
						<?php wp_dropdown_categories('show_option_all='.__('Pays - Régions', 'appthemes').'&hierarchical='.get_option('cp_cat_hierarchy').'&hide_empty='.get_option('cp_cat_hide_empty').'&depth='.get_option('cp_search_depth').'&show_count='.get_option('cp_cat_child_count').'&orderby='.get_option('cp_cat_orderby').'&title_li=&use_desc_for_title=1&tab_index=2&name=scat&selected='.cp_get_search_catid().'&class=searchbar&taxonomy='.APP_TAX_REG); ?>
						
							<?php wp_dropdown_categories('show_option_all='.__('Idée de séjour', 'appthemes').'&hierarchical='.get_option('cp_cat_hierarchy').'&hide_empty='.get_option('cp_cat_hide_empty').'&depth='.get_option('cp_search_depth').'&show_count='.get_option('cp_cat_child_count').'&orderby='.get_option('cp_cat_orderby').'&title_li=&use_desc_for_title=1&tab_index=2&name=scat&selected='.cp_get_search_catid().'&class=searchbar&taxonomy='.APP_TAX_IDS); ?>

					
						<?php wp_dropdown_categories('show_option_all='.__('Expérience', 'appthemes').'&hierarchical='.get_option('cp_cat_hierarchy').'&hide_empty='.get_option('cp_cat_hide_empty').'&depth='.get_option('cp_search_depth').'&show_count='.get_option('cp_cat_child_count').'&orderby='.get_option('cp_cat_orderby').'&title_li=&use_desc_for_title=1&tab_index=2&name=scat&selected='.cp_get_search_catid().'&class=searchbar&taxonomy='.APP_TAX_EXP); ?>
						</div>
				
					<button class="submit" type="submit" tabindex="3" title="Rechercher" id="go" value="search" name="sa">Rechercher</button>

				</form>
Modérateur
@jb: Smiley lol

@dreadstock :

Tel que tu as mis le code sur le forum, c'est illisible et crade (Tu veux de la sauce bolognaise dans tes spaghetti ?) :

//...
else { ?> value="<?php _e('What are you looking for?','appthemes'); ?>" onfocus="if (this.value == '<?php _e('What are you looking for?','appthemes'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('What are you looking for?','appthemes'); ?>';}" <?php } ?> />
//...


On s'est pas qui fait quoi ?
wp_dropdown_categories ????
get_search_query() ???
get_option() ???
etc.

1. Peux tu mettre le code html généré et si possible indenté ?
2. Peux tu mettre le code de la structure de/des table/tables sql sur lequel tu veux taper ?
3. Peux tu mettre les données retournées par le formulaire ?

Je ne connais pas bien wordpress. Je peux t'aider en écrivant une requête dynamique. J'ai déjà fait un moteur de recherche simple en multicritères .
Modifié par niuxe (31 May 2013 - 09:33)