ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Do a search without submitting a form?

December 08, 2007 9:58am

Subscribe [7]
  • #1 / Dec 08, 2007 9:58am

    Mark Huot

    587 posts

    Is there any way to do a search without submitting a form? For example, I’d love to be able to link to search result pages such as this: http://www.example.com/search/terms+here. However, as far as I can tell EE requires the keywords to come through as a $_POST variable?

  • #2 / Dec 10, 2007 5:49am

    Andrew Weaver

    206 posts

    Not sure whether this is any help…

    I wrote a plugin that uses cURL to take a url segment and post it to a (simple) search form.

    There’s more details here:

    http://www.brandnewbox.co.uk/logbook/article/setting_up_an_expression_engine_opensearch_plugin/

    The plugin could do with some extra work, but it worked as a test of the concept.

  • #3 / Dec 10, 2007 5:11pm

    Mark Huot

    587 posts

    I whipped up a little extension to do just this. You can set it with a results page, the results per page etc. It takes a regular expression URL and turns that into a valid search.

  • #4 / Dec 11, 2007 8:25am

    elemental

    77 posts

    Mark, I have yet to try out your new extension but I was looking for a similar thing and was redirected to “Auto Search”. Which helped me but I’d like the URI stay as you have formatted it htp://example.com/search/keywords rather than what is looks now.

    Maybe this will be helpful

  • #5 / Dec 11, 2007 9:16am

    Mark Bowen

    12637 posts

    Hi Mark / Andrew,

    Mark just noticed your post here with the extension and was wondering how you go about using it. I like your thinking on this one and so I installed the extension but didn’t after that really know what to do with it.

    Do we need to put some special code into a template somewhere or is this just a work in progress between yourself and Andrew? Just fascinated by it really and was wondering exactly how it works.

    Best wishes,

    Mark

  • #6 / Dec 11, 2007 9:45am

    Mark Huot

    587 posts

    You shouldn’t have to do anything. Basically it’s set up so that when you navigate to /search/for/term, a new search will be performed and you will be redirected to the search results page (specified in the extension settings).  Basically:

    1. Go to /search/for/term
    2. EE redirects you to /search/results (by default)
    3. The search should be performed for the keyword `term`

  • #7 / Dec 11, 2007 2:31pm

    Mark Bowen

    12637 posts

    Hi Mark,

    Sorry to be a pain on this. I just tried this on a dev install of ExpressionEngine 1.6.1

    I went to http://localhost:8888/ee/index.php/search/for/two

    I have an entry in the default_site weblog which I have placed into the extensions settings and when I hit the URL above all that happens is the search form comes up not the results template though.

    Any thoughts on this as it seems like a great little addition if it works.

    Thanks.

    Best wishes,

    Mark

  • #8 / Dec 11, 2007 3:45pm

    Mark Huot

    587 posts

    Whoops, some site specific stuff to my build was in there, which I’ve removed, so it should work for you now.

  • #9 / Dec 11, 2007 4:12pm

    Mark Bowen

    12637 posts

    Hi Mark,

    Thanks! Just checking it out now.

    Best wishes,

    Mark

  • #10 / Dec 11, 2007 4:24pm

    Mark Bowen

    12637 posts

    Hi Mark,

    Don’t know if I am doing something daft or not but when I go to :

    http://localhost:8888/ee/index.php/search/for/yahoo

    I have a post in the default_site weblog with the word yahoo in one of the fields (main body) if I go this URL it just re-directs me to :

    http://localhost:8888/index.php/search/for/good/?ACT=19

    Any ideas what that is all about?

    Thanks.

    Best wishes,

    Mark

  • #11 / Dec 11, 2007 5:14pm

    Mark Huot

    587 posts

    That should bring you to your search results. Try settings the [/b]No Search Results[/b] field to a valid template within the extension settings and see what happens?

  • #12 / Dec 11, 2007 7:03pm

    Mark Bowen

    12637 posts

    Hi Mark,

    Still nothing I’m afraid. Just going to try on a new dev install as I may have borked something with this one. I seem to be doing that a lot lately!

    Best wishes,

    Mark

  • #13 / Dec 11, 2007 7:10pm

    Mark Bowen

    12637 posts

    Hi Mark,

    Unfortunately no joy here still. Not too sure what is going on though. It just keeps on going back to this page :

    http://localhost:8888/index.php/search/for/getting/?ACT=19

    Oh well, never-mind I will stop pestering you about this. If everyone else can get it working though then I will probably try again some other day, possibly on a live web server instead of a dev server, maybe that is having something to do with it?

    Thanks again.

    Best wishes,

    Mark

  • #14 / Dec 12, 2007 2:48am

    Mark Huot

    587 posts

    Oh no! I hate to hear that :-(. A quick question: what version of PHP are you running? Are you running this on a Windows machine or a Linux box?

  • #15 / Dec 12, 2007 5:32am

    Mark Bowen

    12637 posts

    Hi Mark,

    Pretty sure it was on PHP 4 using MAMP on Mac OSX. May have been version 5 of PHP though. I will have to check when I am back tonight though as not at the machine at the moment.

    Don’t know if that makes a difference?

    Best wishes,

    Mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases