Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-03-22 20:45:02

pierlu
Member
Registered: 2014-08-12
Posts: 153

modulo "cerca"

Per la prima volta ho fatto il modulo “cerca”:
scrivendo cosi <div class=“searchBox”> <form method=“get” action=”<txp: site_url />”> <label>Cerca nel sito</label> <input type=“text” name=“q” /> <txp:if_search> value=”<txp:search_term />”</txp:if_search>><input type=“submit” value=”<txp:text item=‘go’ />”></p>
</form> </div><!— searchBox —<

Quando clicclo su go mi linka a una pagina senza css come faccio a reindirizzare ìl link alla paginsa dei risultati di ricerc<a?=

Offline

#2 2015-03-23 17:07:19

pierlu
Member
Registered: 2014-08-12
Posts: 153

Re: modulo "cerca"

Dovro fare una pagina dei risultati, per collegarlo al link go come faccio?

Offline

#3 2015-03-23 21:05:24

pierlu
Member
Registered: 2014-08-12
Posts: 153

Re: modulo "cerca"

funziona sono riuscito con il seguente codice <div class=“serch”> <div class=“titoloSezione”><h1>Risultati ricerca effettuata</h1></div> <div class=“ris1”> <h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><txp:search_result_excerpt hilight=“p” limit=“15” />
<small><txp:permlink><txp:permlink /></txp:permlink> · <txp:posted /></small></p><a href=”#”>Vai</a> </div> </div>!— search —>

Vorrei però invece di vederflo sotto il forrn vorrei vederlo in una pagina apposita.

Offline

#4 2015-06-08 19:16:15

pierlu
Member
Registered: 2014-08-12
Posts: 153

Re: modulo "cerca"

non funziona correttamente:

Il form che ho creato è il seguente <div class=“searchBox”> <form action=”<txp:site_url />”> <label>Cerca nel sito</label> <input type=“text” name=“q” /> <input type=“submit” value=“Cerca”> </form> <!—DARE STILE TASTO CERCA—> </div><!— searchBox —> <txp:if_search> <txp:article pgonly=“1” limit=“10” /> <txp:if_search_results> <p>These articles match your search request: </p> <txp:article limit=“10” searchform=“risultaticerca” /> <txp:else /> </txp:if_search_results>
<txp:if_search>

Offline

#5 2015-06-08 21:12:19

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: modulo "cerca"

pierlu wrote #291429:
[code … code … code]
<txp:if_search>

… is not a closing tag, right?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2015-06-09 03:04:41

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: modulo "cerca"

I made the last code example readable, but I don’t understand the question:

<div class="searchBox">
	<form action="<txp:site_url />">
		<label>Cerca nel sito</label>
		<input type="text" name="q" />
		<input type="submit" value="Cerca" />
	</form>
</div>
<txp:if_search>
	<txp:article pgonly="1" limit="10" />
	<txp:if_search_results>
		<p>These articles match your search request:</p>
		<txp:article searchform="risultaticerca" />
		<txp:else />
	</txp:if_search_results>
</txp:if_search>

Offline

#7 2015-07-29 21:05:59

pierlu
Member
Registered: 2014-08-12
Posts: 153

Re: modulo "cerca"

I have tried to make the following form it looks for with the following code:

<div class="searchBox">
<form action="<txp:site_url />">
<label>Cerca nel sito</label>
<input type="text" name="q" />
<input type="submit" value="Cerca" />
</form>
</div>

In the page of the results I have written this way

<div class="titoloSezione">
            <h1>I risultati di ricerca</h1>
            </div>   <!-- titolo-sezione -->
      <txp:if_search>
  <txp:article pgonly="1" limit="10" />
  <txp:if_search_results>
    <p>These articles match your search request: </p>
  <h3><txp:search_result_title /></h3>  
 <txp:article limit="10"  searchform="risultaticerca" />
    <txp:else />   
  </txp:if_search_results>
</txp:if_search>  

But when I try the motor of search and I select it looks for the desired page it doesn’t come

Why?

Moderator’s annotation:
Edited to add Textile’s bc. for better readability.
– Uli –

Last edited by uli (2015-07-29 21:29:32)

Offline

#8 2015-07-29 21:29:15

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: modulo "cerca"

pierlu wrote #293811:

But when I try the motor of search and I select it looks for the desired page it doesn’t come

What doesn’t come, pierlu, do you have no search results, is the page totally empty, is the wrong page displayed, do the results display the wrong elements, e.g. excerpts instead of titles, etc?

Edit: And please(!) format your code yourself, it’s no fun reading through garbage.

Last edited by uli (2015-07-29 21:30:44)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2015-07-29 22:32:01

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: modulo "cerca"

I’m guessing here, but check the following:

  1. Your first code block creates a search form which sends the search request to the default page: action="<txp:site_url />">.
  2. Your second code block has to go within an <txp:if_search> … </txp:if_search> part of the page template that you use for the default section. If you have put it in another page template, it will never be called.

If you want to use a special section for your search results, see this txptip – Search using non-default section.
If you do want to use the default template, check this txptip – Search with textpattern.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB