Adding Search to every page?

Discussion in 'Technical Support' started by nagrap2, Feb 2, 2009.

Thread Status:
Not open for further replies.
  1. nagrap2 Customer

    Hi,

    I would like to add the advanced search options on every page of my site. Currently, the out of the box solution places just the Search input box on every page.

    However, i would like to also place the List of Categories drop down, City and Country.

    Can someone provide me with the approach to take. I'm not looking for all the code, just the approach.

    For example, do I combine the current code that is in search.php and search.tpl into my layout.tpl file? If so, can I have statements that are present in a php file in a tpl file?

    Or do I merely place the search.php code into my init.php file, since I want to make this available to all files?

    Thanks in advance,
  2. Eric Barnes Guest

    What I would probably do is take the code from search.php and add it to a plugin. Then you could just call the plugin which would give you the form.
  3. Lhotch curmudgeon

    I think if I were to tackle something like this I would make a plugin, which is just a php script. Have it query the database to get categories, cities and countries and build dropdowns. Echo those along with the text input box and submit button withe forms target the exisiting search results script. Then all you would have to do is put the plugin name in the template where you would want the search to appear.
  4. nagrap2 Customer

    Larry / Eric,

    Thanks for the prompt response.

    Just so I'm clear, I would create a php file to setup the form and then call that php file from within a tpl file.

    What is the correct syntax for calling the php file from within the tpl file?

    Is it any of the following?

    {include_php file='/path/to/file.php'}

    OR

    {php}
    include("/home/.../public_html/includes/file.php");
    {/php}
  5. Lhotch curmudgeon

    The best thing to do would be to look at your home.tpl template down at the bottom you can see the call to the featured listings plugin. That plugin takes arguments so there is some additional info after the plugins name.

    But in short, any file in the plugin folder is automatically accessible by just dropping the plugins name in any template ie

    {myplugin}

    There are different kinds of plugins but using the featured listing horizontal thats called by home.tpl should offer enough guidance to get ya started.
  6. seymourjames All Hands On Deck

Thread Status:
Not open for further replies.

Share This Page