Forum

Thread tagged as: Question, Addons, Forum

Search function

I want a search bar on every page which then redirects to a results page (plus just to search results of the blog posts). I know this is possible but Im not sure what code to write and where in order to get the correct search bar on every page.

Timothy Rackham

Timothy Rackham 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You would put the search form on any page that you want search to be on (or in a Perch Layout file) and point the action to the results page which has the logic on to show the results.

Do you think you could give me an example?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

There is an example search file in your Perch download.

so I have added the action into the search form template file. Is this what you meant ?

<perch:form id="search" method="get" action="results.php">
    <div>
        <perch:label for="q">Search</perch:label>
        <perch:input type="search" id="q" />
        <perch:input type="submit" value="Go" />
    </div>
</perch:form>
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks ok - is it doing what you want?