<!---------------------

Working example without an input box?  I just want to get this to work
with an input box any comments or thoughts would be greatly
appreciated thanks:

Model:

<?php
// app/models/yahoo.php
vendor('zend_loader_yahoo');

class Yahoo extends AppModel
{
  var $useTable = false;

  function __construct()
  {
    ZendLoader::load('Service/Yahoo');
  }

  function getResultsby($yahoosearch)
  {
    $result = array();

    if (!empty($yahoosearch))
    {
    $yahoo = new
Zend_Service_Yahoo("9Jd3X77V34H7qkFUr4RPUBOe5Uw77BnFogvFtRymuyW7pWMxwcadkV.Ag4QwluKU7tu9Hwo-");
    $result = $yahoo->webSearch($yahoosearch);

        }

    return $result;
  }
}
?>

View for show

<?php
// app/views/yahoo/show.thtml
foreach ($question as $answer)
{
echo "<h3><a href='{$answer->ClickUrl}'>{$answer->Title}</a></h3>";
echo "{$answer->Summary}
[<a href='{$answer->CacheUrl}'>Cached Version</a>]";
}
?>


Controller:

<?php
// app/controllers/yahoo_controller.php


class YahooController extends AppController
{

  var $helpers = array('Html', 'Ajax');
  var $layout = 'yahoo';

  function index()
  {
  }

  function showresult($yahoosearch = null)
  {
  $this->set('question', $this->showresult($yahoosearch));
  $yahoo = new
Zend_Service_Yahoo("9Jd3X77V34H7qkFUr4RPUBOe5Uw77BnFogvFtRymuyW7pWMxwcadkV.Ag4QwluKU7tu9Hwo-");
  $yahoosearch = $yahoo->webSearch('question');
  return $yahoosearch;
  $this->log('Something broke');
  }


  function show($yahoosearch = null)
  {
    $this->set('question', $this->Yahoo->getResultsby($yahoosearch));
  }
}


?>

----------->

The previous example works minus the input box example:

http://ihang10.com/yahoo/show/test

I would like to get this to work for the ajax version but I am having
a tough time passing the variable of the input box.

On Sep 24, 8:10 am, seacloud9 <[EMAIL PROTECTED]> wrote:
> I have been working on this issue for a few days I am just really
> stumped please if anyone could comment on this issue I wold be greatly
> appreciated.
>
> On Sep 21, 11:32 am, seacloud9 <[EMAIL PROTECTED]> wrote:
>
> > I am trying to create a Yahoo Search. I think it is breaking where I
> > send the variable.. Your Help Would be greatly appreciated thanks:
>
> > Current Error:
> > Notice: Undefined variable: javascript in..
>
> > Control
> > function showresult($yahoosearch = null)
> > {
> > $this->set('question', $this->showresult($yahoosearch));
> > $yahoo = new
> > Zend_Service_Yahoo("APIKEYYESONTHELIVEVERSIONITISHERE");
> > $yahoosearch = $yahoo->webSearch('question');
> > return $yahoosearch;
> > $this->log('Something broke');
>
> > }
>
> > Index View:
>
> > <?=$ajax->form(array('action'=>'/yahoo/showresult'), 'post',
> > array('update'=>'yahoosearch','loading'=>"Toggle.display('spinner');",'complete'=>"Toggle.display('spinner');stripe();"))?
>
> > <?=$html->image('spinner.gif', array('alt'=>'spinner',
> > 'id'=>'spinner', 'style'=>'display:none;'))?>
> > <fieldset>
> >   <label for="showresult">Search:</label>
> >   <?=$html->input('Yahoo/yahoosearch',array('type' => 'text', 'size'
> > => '25'))?>
> >   <?=$html->submit('Find')?>
> > </fieldset>
> > <div id="yahoosearch"></div>
> > </form>
>
> > Show Result:
>
> > <?php
> > // app/views/yahoo/show.thtml
> > foreach ($question as $result)
> > {
> > echo "<h3><a href='{$result->ClickUrl}'>{$result->Title}</a></h3>";
> > echo "{$result->Summary}
> > [<a href='{$result->CacheUrl}'>Cached Version</a>]";}
>
> > ?>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to