Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.1.2beta
|
MIT license |
0.1.0beta
|
10/08/2010 |
Changelog for release 0.1.2 - 10/08/2010
Other releases
Release 0.1.2 - 10/08/2010
The sfYahooBossPlugin allows you to easily integrate web search into your Symfony project.
- Easily add search functionality to your project
- Set the search results to a single site
- Includes Delicious saves, tags, Searchmonkey data
The sfYahooBossPlugin is licensed under the MIT License.
Add you Yahoo Boss API
You can eiter set your key each time you instatiate the YahooBoss object:
[php]
$YahooBoss = new YahoooBoss('API_KEY');
Even better, set the api key in your app.yml file:
[plain]
all:
yahooboss_api_key: your_api_key
Action configuration
Update your action to show the search form and results.
Create the form:
// apps/[APP_NAME]/modules/[MODULE_NAME]/actions/actions.class.php
class MyActionActions extends sfActions
{
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->form = new YahooBossForm();
//call the new search action
$this->processSearch($request,$this->form);
}
}
Next, create the processsSearch action:
[php]
//...
protected function processSearch(sfWebRequest $request, sfForm $form)
{
if (!$request->getParameter('search'))
{
$this->boss = array('results'=>null);
$this->csrf_token = null;
return;
}
$this->form = new YahooBossForm();
$this->form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($this->form->isValid())
{
$search = new YahooBoss();
//see http://developer.yahoo.com/search/boss/boss_guide/News_Search.html
//for date ranges
// $search->setAge('100d');
//see http://developer.yahoo.com/search/boss/boss_guide/Web_Search.html#optional_args_web
// for view args
$view = '';//delicious_saves,delicious_toptags,keyterms,searchmonkey_feed
$search->setView($view);
$search->setCount(10); //number of results per page
$search_query = $request->getParameter('search');
$this->query = $search_query['q'];
//the search query
$search->setQuery($this->query);
//limit results to one site
// $search->setSite('seoatl.com');
// $search->setOrderByDate();
if(!isset($search_query['start']))
{
$this->start=0;
} else {
$this->start = $search_query['start'];
}
$search->setStart($this->start); //important for pagination
$this->boss = $search->execute();
$this->csrf_token = $search_query['_csrf_token'];//need to pass csrf token if enabled
}
}
2010-08-09 | 0.1.0-beta