Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-03-31 03:55:48

conspirator
Member
From: Chicago
Registered: 2007-03-31
Posts: 35
Website

Getting custom search to function

Hello all!

One of our front-end guys wants a specific look to this search bar, so I can’t use the pre-packaged TP search. I consider myself a total newbie on this, but how do I get this to work in Textpattern???

[code]
<div id=“search”>
<form action=”“> <input name=“search” type=“text” value=” search” size=“35” style=“color: #c63; border:none;” /> <button name=“go” type=“submit” class=“go” onmouseover=“this.className=‘goover’” onmouseout=“this.className=‘go’” value=”&nbsp;&nbsp;” alt=“GO”></button>
</form>
</div><!—search—>
[/code]

Offline

#2 2008-03-31 04:53:26

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Getting custom search to function

<div id="search">
	<form action="<txp:site_url/>" method="get">
		<input name="q" type="text" value="search" size="35"/>
		<button name="go" type="submit" class="go">Go</button>
	</form>
</div><!--//search-->

Take a look at descendant selectors too – you don’t need inline styling. The button event handlers are pointless, as they are the equivalent of #search button:hover {} (for IE <7, use external JS).

Last edited by jm (2008-03-31 04:53:34)

Offline

#3 2008-03-31 13:51:16

conspirator
Member
From: Chicago
Registered: 2007-03-31
Posts: 35
Website

Re: Getting custom search to function

How do I get the form to hook up with my search section/page? I’m looking for the search to take me to something like this.

http://www.emqus.com/?s=search&q=podcasts

Any clues?

Offline

#4 2008-03-31 17:15:34

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Getting custom search to function

You could use <form action="<txp:site_url />search" method="get"> to take you to the search section.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2008-04-02 19:22:59

conspirator
Member
From: Chicago
Registered: 2007-03-31
Posts: 35
Website

Re: Getting custom search to function

I’d like it to have “Search” in the input field by default. How would I do this?

Offline

#6 2008-04-02 23:08:30

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Getting custom search to function

Use value=“Search” for the input.

Last edited by thebombsite (2008-04-02 23:08:47)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#7 2008-04-02 23:35:16

conspirator
Member
From: Chicago
Registered: 2007-03-31
Posts: 35
Website

Re: Getting custom search to function

I need more help here… Version 1 works, but the second doesn’t. In a perfect world, I’d love to have version 2. It’s stylized and works better with the design. Can someone please help me? The form action in version 2 doesn’t seem to bring me to the right place.

Version 1
<txp:search_input section=“search” />

Version 2
<form action=”<txp:site_url />?s=search/” method=“get”> <input name=“q” type=“text” value=“search” size=“35”/> <button name=“go” type=“submit” class=“go”>Go</button>
</form>

Offline

#8 2008-04-02 23:49:09

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Getting custom search to function

Is the site using messy URLs? I don’t think you need that slash after ?search.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#9 2008-04-02 23:55:05

conspirator
Member
From: Chicago
Registered: 2007-03-31
Posts: 35
Website

Re: Getting custom search to function

yes, messy urls

Offline

#10 2008-04-03 00:00:19

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Getting custom search to function

Have you tried removing that forward slash?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#11 2008-04-03 00:01:04

conspirator
Member
From: Chicago
Registered: 2007-03-31
Posts: 35
Website

Re: Getting custom search to function

yup

Offline

#12 2008-04-03 00:05:22

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Getting custom search to function

Mmmm. When you use version 1 could you check the source code and see what it outputs for “action”?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB