[turba] [api] $registry->contacts->search
Michael J Rubinsky
mrubinsk at horde.org
Sat Sep 14 15:06:57 UTC 2013
Quoting Jonah Dekeyzer <jonah at menzz.be>:
> I want to make use of the turba API in order to search for items in
> my adresbook in an own module 'advocaat'.
>
> Turba has an adresbook with the sourcename 'advocaat' with several contacts.
>
> When I use the contacts->search api I get en empty result, even
> looking for 'a' .
>
> My php-file looks like this:
> <?php
> require_once __DIR__ . '/../lib/Application.php';
> Horde_Registry::appInit('advocaat');
> $term = $_GET['term'];
> $args = array('sources' => array('advocaat'),
> 'names' => array('a'),
> );
>
> $cns = $registry->contacts->search($args);
>
>
> Has my code an error?
1) What is $term? It's not used anywhere.
2) Related to 1, you are not passing the search term correctly.
It should be something like this:
$registry->contacts->search($search_term, array('fields' =>
array('fields', 'to', 'search'), 'sources' => array('advocaat')));
You should look at turba/lib/Api.php Turba_Api::search() for all the
options and the method signature.
--
mike
The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5849 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/turba/attachments/20130914/2dda8acd/attachment.bin>
More information about the turba
mailing list