Welcome Guest, Not a member yet? Register   Sign In
Using third-party search engine with CI site
#1

[eluser]ebcms[/eluser]
We're developing our first CI application and having some trouble integrating our third-party search engine with the CI MVC framework.

We're using Zoom Search, a tool we've used successfully on other asp and php sites. The search form is working fine and the results are excellent but the tool outputs its results to a page, search.php, that is outside CI.

The problem we're having is in formatting/displaying the search results through CI so that our header, navigation, and footer views will display properly.

Does anyone have suggestions on how to properly integrate third-party tools like this within a CI site/application framework? Is it possible?

Thanks in advance.

David
#2

[eluser]Randy Casburn[/eluser]
Can you be more precise about what your integration problem is exactly? We can assume you mean when the form is POST'd and you retrieve the search results from your DB or such. But you should guide us through your use case so we don't make the wrong assumptions here.

Quote:The problem we’re having is in formatting/displaying the search results through CI so that our header, navigation, and footer views will display properly.

In what way, where, when, why. Is this a problem in the View, the Controller, pulling data from the Model? You see? What precisely is the difficulty that you need help with?

Randy
#3

[eluser]ebcms[/eluser]
Thanks Randy.

Sorry my post was light on details.

Some background: The search tool spiders the site and creates a set of files which are saved (or FTP'd) to the domain/directory location designated. These files include search.php (which handles processing the search query and the results display), plus all the data files from the indexing, which are used by search.php. We added a custom search form to our main header/navigation view that passes the search term via GET to the search.php file for processing. Search.php is receiving the query term properly. Our results are good and the output to search.php is working correctly.

Our issue is in how to integrate search.php into our MVC structure.

In a traditional php environment, we'd simply wrap search.php with header and footer includes and be done.

But in our CI site, we're trying to figure out how best to wrap these results with our header and footer views (both of which use dynamic data from our model). Can we call the search.php file via the controller? Should we include search.php in it's own view and call that view via the controller?

I guess the larger question here too, is what are some best practices for incorporating external data and/or files into CI generated "pages" for display.

Thanks,

David
#4

[eluser]Randy Casburn[/eluser]
ebcms --

The GET vs. POST thing will be a bit tricky because you are setting aside a big porting of the CI magic with that... but we'll get back to that.

This my appoach. In my controller:

Code:
$this->load->model('Whatever');
    $hData = $this->Whatever->getHeaderStuff();//Do whatever you want here
    $fData = $this->Whatever->getFooterStuff();//Do whatever you want here

    $this->load->view('common/header', $hData);
    $this->load->view('integrated/search');
    $this->load->view('common/footer', $fData);

Depending on the application/site I maintain Views in folders like:

Code:
[ view ]
  [ common ]
     header.php
     footer.php
  [ private ]
     login.php
     logout.php
     acctmgr.php
  [ public ]
     welcome.php
  [ integrated ]
     search.php

I don't think this comes close to answering your question, but this is how I wrap an intgrated "view" with a header and a footer.

We still need to deal with the REQUEST data...

Randy
#5

[eluser]ebcms[/eluser]
Thanks, Randy.

We'll give it a try.

David




Theme © iAndrew 2016 - Forum software by © MyBB