We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

exp:channel:entries search tag not working

Development and Programming

Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

Below code ignores my search:title parameter. It still just spits out everything (only 2 posts thus far). I can’t seem to figure out what it doesn’t search for “test” as I’m asking it to. Also, the tag {if no_results} doesn’t show anything either at any time.

What have I done wrong?

template: /search/result (simplified)

{exp:channel:entries channel="nyheter|sidor" search:title="test}

{title}

{/exp:channel:entries}

{if no_results}

No result

{/if}
       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

You’re missing a closing quote on the search parameter. That might have something to do with it - but I’m not sure. Make that change and see if it helps.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

Also of note - your no_results conditional needs to be inside your channel:entries tag:

{exp:channel:entries channel="nyheter|sidor" search:title="test"}

{title}

{if no_results}

No result

{/if} 

{/exp:channel:entries}
       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

That was just a type by me. I do have the closing quote in my code.

It still doesn’t work. My EE installation is pretty much default stuff.

How can I debug this? Really would like to have this work. Or I’d have to find a way of making an Ajax search form that takes use of EE’s default search module. Is there a pre-made mod for the EE forms that spits out whatever search result there is to a div?

Having the no_results tag inside the exp:channel:entries function helped. It’s not always pointed out if it should be inside outside, but I believe most of the time it should be inside right?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
14 years ago
Lisa Wess's avatar Lisa Wess

The search: parameter works only for custom fields - the title is not a custom field, so this won’t work.

I could swear that Mark Bowen had an add-on to do this, but I can’t seem to find it. :( You may need a custom query to accomplish this.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
14 years ago
Mark Bowen's avatar Mark Bowen
I could swear that Mark Bowen had an add-on to do this, but I can’t seem to find it.

Sorry, nothing made by me to achieve this I’m afraid :-(

I think you may have been thinking of Mark Croxton here maybe? - http://ellislab.com/forums/viewthread/130518/ | http://devot-ee.com/add-ons/search-fields

Best wishes,

Mark

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
14 years ago
Lisa Wess's avatar Lisa Wess

Hrm, I thought the one I was thinking of was very specifically the title only. But you may be right, Mark. Thank you. =)

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
14 years ago
Mark Bowen's avatar Mark Bowen
Hrm, I thought the one I was thinking of was very specifically the title only. But you may be right, Mark. Thank you. =)

No problem. Actually there was an extension that someone made due to a question I had which basically copied whatever was in the title field into a custom field so that you could then search using that field instead.

I’ve not really gotten into extension development in 2.x that strongly yet although I’m fairly certain it could probably be ported over.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

Only on custom fields? Then it requires manual input for SEO to work. Not optimal at all. A combination of the two maybe…

So, I tried to search for a EE addon that enables Ajax and putting the search result in a Div. I couldn’t find any.

Help with that maybe? 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.