Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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=” ” alt=“GO”></button>
</form>
</div><!—search—>
[/code]
Offline
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
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
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
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
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
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
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
Re: Getting custom search to function
yes, messy urls
Offline
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
Re: Getting custom search to function
yup
Offline
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