Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-01-23 15:11:54

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

How do I display a search term on my page?

I am building a search result page and I want the top of this page to read something like this:

“You searched for: <%SEARCH_TERM%>”

How can I extract the search term and display it? I can’t seem to find a tag to do this so maybe someone knows some simple PHP to retrieve the q= variable from the URL.

Offline

#2 2007-01-23 15:54:58

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I display a search term on my page?

<txp:q />

Offline

#3 2007-01-23 16:39:34

monkeynotes
Member
From: UK
Registered: 2005-04-13
Posts: 41

Re: How do I display a search term on my page?

Simple. Thank you.

EDIT: Another quick question, does anyone know how to display a message if the search returns no results?

Last edited by monkeynotes (2007-01-23 16:45:16)

Offline

#4 2007-01-23 17:37:39

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,339
Website GitHub Mastodon

Re: How do I display a search term on my page?

Offline

Board footer

Powered by FluxBB