Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Integrating a Search in My Custom Page...

edited September 2006 in Vanilla 1.0 Help
Hi all -

I am using Page Manager, and have a new custom page labeled "Vote". The page is currently blank, and I would like to add a Search or LiveSearch feature to query another table I have in the MySQL DB that I've already set up, and return a member's search result.

To be more specific, a user is going to enter a stock symbol. I am going to return the stock symbol with company name, and exchange that it's traded on, and also a 5 star-rating system, where they can vote on the stock. I can get a preliminary test search to work when I have it as a stand alone (http://www.papertrade.us/extensions/PageMng/livesearch.php), but once I get it into the "Vote" page under page manager, it won't return the result.

Would anyone already have something similar (a Search function on a custom page) that you wouldn't mind sharing code with me, or a suggestion? I would love to use the LiveSearch Extension, but it only searches Discussion, Categories, and Users, and I am unable (as my knowledge goes) to make it also do a query on my other table in the same DB. I do know SQL, but am a novice when it comes to PHP.

Comments

  • You can use php in the html field for the page, so if you have a certain php script which can operate when embedded into another page (eg. doesn't make links to a fixed url), then you could do something as simple as<?php include('somepage.php'); ?>
  • Alright - so I've got the search part worked out now. I still need to integrate it into Vanilla, but I am very happy with what I've come up with. Please see the following link if you're interested at implementing a LiveSearch with PHP and MySql outside of Vanilla:

    http://www.file.sc/643b5e/LiveSearch_Files.zip

    If you'd like to test it out, here is the URL:

    http://www.papertrade.us/searchtest/

    Next, I'll be working to integrate into my Vanilla forum. Any suggestions based on the script (linked above) would be greatly appreciated.

    Regards -

    Scott
  • I believe, although I don't have a db to fully test it, that all you really have to do is put all that in a folder somewhere in vanilla, place the contents of index.php (minus the doctype, html/body tags) in as the page html, then convert the include path (eg. to './livesearch/php/ajaxLiveSearch.inc' if it's in a folder called 'livesearch' in the vanilla root dir). You also would need to change the declaration of JSPath in ajax.inc to point to './js/' instead of '/javascript/', and any image paths to their appropriate locations.
  • SirNot!

    It does work!

    I changed the path of the spinner.gif (ajaxLiveSearch.inc), shortened the /javascript URL to /js per your suggestion (ajax.inc), and changed the path in the index.html from just php/.. to livesearch/php... where I put all files and folders.

    Thank you for your help with that - it took all of 5 minutes, where I thought I'd be spending days figuring it out! I need to buy you a few drinks :D Maybe I can request for Mark to put that add-in here on the forums.

    Regards,

    Scott
This discussion has been closed.