Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-01-10 16:30:53

mikkeX
Archived Plugin Author
Registered: 2004-02-26
Posts: 74

Re: Search category only

No, my question is the same from the beginning to the end. I Asked if you could use a wildcard because you said you could not have an empty question. I only tried to describe what I was after in different way.

Offline

#14 2008-01-10 21:09:30

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

Re: Search category only

mikkeX wrote:

No, my question is the same from the beginning to the end. I Asked if you could use a wildcard because you said you could not have an empty question. I only tried to describe what I was after in different way.

Thanks for the reply, but it is not what I am looking for, and it does not work on the site. My english is not so good, but I will try to exemaple better.

I have the categories in a drop down list.

When I do a search with something in the search field and choose a category it works, for example:
http://www.etc.se/?c=debatt&sort=relevans&q=johan

That works fine, but if I only want to search a category for every article in section ‘debatt’ it does not work:
http://www.etc.se/?c=debatt&sort=relevans&q=

So if the search field is empty I do not get any results from do a search for everything in the category.

Quite odd way to explaint that, as you can’t have empty search – or you could – search of empty.

Cheers!

Offline

#15 2008-01-10 21:15:18

mikkeX
Archived Plugin Author
Registered: 2004-02-26
Posts: 74

Re: Search category only

Odd or not. That was what my question is about – if you could have empty in search field, as you can with others CMS-system, and just list every article from a specific category on the searchpage. And I do understand that that could not be done with Textpattern, so I have to write my own code or plugin to do it. Thanks for you time.

Offline

#16 2008-01-10 21:27:43

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Search category only

mikkeX wrote:

Odd or not. That was what my question is about – if you could have empty in search field, as you can with others CMS-system, and just list every article from a specific category on the searchpage. And I do understand that that could not be done with Textpattern, so I have to write my own code or plugin to do it. Thanks for you time.

can i see an example of this in another CMS? i’m still not sure exactly what you’re looking for. from what i can tell, as an example, you want to be able to go to a site like google.com, press the search button with NO search terms in it, and then expect it to just give you ALL results of EVERYTHING? is that correct?

sounds like you’re not actually looking for more SEARCH functionality as you are just looking for another navigation method on your search page. i don’t understand why anyone would want to go to your search page in order to view the contents of an entire, specific category. couldn’t you just give the link to each category somewhere else?

Offline

#17 2008-01-10 22:41:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,449
Website GitHub

Re: Search category only

Man, this is confusing :-) but I think I understand what you’re asking.

Just to go right back to basics for a second, when you submit a search from the <txp:search_input /> it calls the page indicated by the section attribute. Without that attribute it goes back to the “front page”. Either way, if that page contains a <txp:if_search> tag and the query string ?q contains something the code under the if_search will be executed. If the test fails, the <txp:else /> branch is followed, right?

As others have mentioned it is difficult to have the page detect for two conditions (?C AND ?q) — I think even the smd_if plugin would struggle, though you are welcome to try it out.

Is it perhaps possible to do the following: Make a specific section for your search results and direct your search_input there. On that page, put code like this (I haven’t tested it but it might give you an idea) :

<txp:if_search>
  // search results here
<txp:else />
  // There are NO search results...
  <txp:if_category>
     // ... and a category is selected, list the articles in that category
     <txp:article />
  <txp:else />
    // ... and NO category is selected
    // do something else
  </txp:if_category>
</txp:if_search> 

As I say, I don’t know if it will work but it might. If the above code was on your default page, the first ELSE portion would always be executed every time a page is requested without a ?q search term, which is probably not ideal. Forcing the search to its own section helps keep the logic simpler and separates “normal” page flow from this “exceptional” case.

If I’ve misundertood and that’s not what you are after either, then sorry. Perhaps send me an e-mail in (simple) Swedish explaining what you want to do? My wife spent a year there and knows the basic language reasonably well so — as long as it’s not too technical — she might be able to translate what you want and we can go from there!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#18 2008-01-11 10:01:33

mikkeX
Archived Plugin Author
Registered: 2004-02-26
Posts: 74

Re: Search category only

Ah – thanks Bloke, that was what I were looking for. I will use it for a starting point and come to tell you if it is works.

Offline

Board footer

Powered by FluxBB