Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2008-09-15 22:04:35

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

How do I get it so say they search for something, and they have no results, and I want to put something saying this. I’ve tried adding a txp else tag to the search_results form, but no luck :S


~ Cameron

Offline

#17 2008-09-15 22:05:40

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Search Page

Hint: there are several other search related tags (see Textbook)

Offline

#18 2008-09-15 22:10:44

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

Offline

#19 2008-09-15 22:11:00

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

These are only ones i see :S

<txp:search_input />
<txp:search_result_count />
<txp:search_result_date />
<txp:search_result_excerpt />
<txp:search_result_title />
<txp:search_result_url />
<txp:search_term />


~ Cameron

Offline

#20 2008-09-15 22:12:26

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

Re: Search Page

I

Offline

#21 2008-09-15 22:13:58

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Search Page

driz wrote:

These are only ones i see :S

Look for i, like if. There you will find if_search_results and it’s other search related conditional friends.

Edit: Dang, not Jon nor John, but Jon-Michael, JM, beat me :P

Last edited by Gocom (2008-09-15 22:15:46)

Offline

#22 2008-09-15 22:16:26

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

Okies, I have this so far, but even WHEN they have a legitimate search it’s still saying Sorry…

					<txp:if_search>
	<p style="font-size:2.5em;">You searched for: <txp:page_url type="q" /></p>
<txp:else />
<p>begin searching by typing in the search box in the top right corner</p>
	</txp:if_search>
			</div>

		<div id="body">

        <div id="maincontent" style="width:980px;">

<div class="innerBlocks">

<txp:if_search_results>
<p>These articles match your search request: </p>
<txp:else />
<p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p>
</txp:if_search_results>

	<txp:if_search>

	<txp:article form="search_results" sort="Section asc" />

	<txp:else />

	<p>No Content Available...</p>

	</txp:if_search>

~ Cameron

Offline

#23 2008-09-15 22:20:33

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

Re: Search Page

Honestly, do you ever take some time to read?

Edit: sorry, spoke too soon :(
I think you need only one set of if_search tags, wrap that entire block of code in it.

Last edited by els (2008-09-15 22:25:08)

Offline

#24 2008-09-15 22:23:46

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

Els wrote:

-Honestly, do you ever take some time to read

What? :S How does those attributes change anything? They’re for the max and min only right, unless I’m missing something, please explain. x


~ Cameron

Offline

#25 2008-09-15 22:25:46

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

Re: Search Page

Edited my post.

Offline

#26 2008-09-15 22:32:03

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

Urgh I’m super confused now, which tags am I using here :S

I have the if_search to detect if we are searching or not, ie you have searched or are just on the search page
and I have the if_search_results to detect if we have search results or not and show either a yes or no answer

Which one needs wrapping inside the other (if at all).

Thank you


~ Cameron

Offline

#27 2008-09-15 22:44:26

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Search Page

Not sure why it isn’t working, but for clarity, I would write the last part of your code as this:

<txp:if_search>
  <txp:if_search_results>
    <p>These articles match your search request: </p>
    <txp:article form="search_results" sort="Section asc" />
  <txp:else />
    <p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p>
  </txp:if_search_results>
<txp:else />
  <p>No Content Available...</p>
</txp:if_search>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#28 2008-09-15 22:53:11

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

okies, now the search ALWAYS says no results were found (it doesnt display them either) :P

there are several articles called Lorem Ipsum, and here is a test search: http://www.simplecandy.com/search?q=lorem+ip

But the results don’t show :S

Last edited by driz (2008-09-15 22:56:21)


~ Cameron

Offline

#29 2008-09-15 23:04:08

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

Re: Search Page

We forgot to tell you about pgonly: just put <txp:article pgonly="1" /> before the if_search_results tag. It doesn’t display anything but it is needed to count the articles.

<txp:if_search>
<txp:article pgonly="1" />
  <txp:if_search_results>
    <p>These articles match your search request: </p>
    <txp:article form="search_results" sort="Section asc" />
  <txp:else />
    <p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p>
  </txp:if_search_results>
<txp:else />
  <p>No Content Available...</p>
</txp:if_search>

Offline

#30 2008-09-15 23:09:24

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

Out of curiosity, how many be default (search links) will be displayed and do they have pagination?

And the code changed fixed the bug, cheers :) x

Last edited by driz (2008-09-15 23:10:19)


~ Cameron

Offline

Board footer

Powered by FluxBB