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.

Search by URL Segment?

August 04, 2009 6:37pm

Subscribe [3]
  • #1 / Aug 04, 2009 6:37pm

    Peter Baker

    49 posts

    Is it possible to run a search by a url segment (without the AutoSearch method explained here: http://expressionengine.com/wiki/AutoSearch/)?

    We’re using EE to return XML to Flash, and the Flash swf needs to request xml for everything by url segments, which is fine for everything but search. If I have a url like:

    /questions-xml/search/SEARCHTERM/

    How can I use {segment_3} to search entries? I don’t believe the Flash can follow a url redirect that submitting the form would require, unless I’m wrong about that. I’m plenty comfortable with manually querying things (doing that a lot for this complicated profile > question > answer > response structure), so if it needs to be done that way, that’s cool too, I just don’t know where to start.

    Thanks,
    Pete

  • #2 / Aug 04, 2009 7:39pm

    Greg Aker

    6022 posts

    How are you doing the search?  What if you used PHP on input with the Input Class?

    -greg

  • #3 / Aug 05, 2009 2:55pm

    Peter Baker

    49 posts

    Ideally we’d just use EE’s built in search. I’m fine with using the Input Class to get the segment, but how to I post that segment to the search results processor? Would I need to disguise it as a POSTed search term?

  • #4 / Aug 05, 2009 5:14pm

    Ingmar

    29245 posts

    I am afraid the Autosearch article you linked to in your initial posting is the closest you can get without some custom coding. If you want to go down that route, let me know and we can move this thread over to Howto.

  • #5 / Aug 05, 2009 5:16pm

    Peter Baker

    49 posts

    Sure, any help would be great, thanks Ingmar.

  • #6 / Aug 05, 2009 5:18pm

    Ingmar

    29245 posts

    Moved as per request.

  • #7 / Aug 05, 2009 6:28pm

    Latitude 10

    18 posts

    I could do something like this:

    <?php
    global $IN;
    $from= $IN->fetch_uri_segment('4');
    ?>
    
    {exp:weblog:entries weblog="{my_weblog}" dynamic="{dynamicTag}" orderby="date" sort="desc" limit="15" 
    disable="member_data|trackbacks" <?php if($from != ""){echo "search=\"".$from."\";}?>}
    
    {/exp:weblog:entries}

    Just change the parse order on preferences.

  • #8 / Aug 06, 2009 1:32pm

    Peter Baker

    49 posts

    Latitude, that makes sense, thanks. I was stuck in trying to get the actual Search function working, completely forgot about the search weblog:entries parameter. Will that work with the “Title” field too?

  • #9 / Aug 06, 2009 1:34pm

    Latitude 10

    18 posts

    Latitude, that makes sense, thanks. I was stuck in trying to get the actual Search function working, completely forgot about the search weblog:entries parameter. Will that work with the “Title” field too?

    It should work. The search params has a lot of options in there
    :D
    Good I could help

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

ExpressionEngine News!

#eecms, #events, #releases