You could use the elgg_get_tags() function.
Thanks - that looks perfect. I wasn't planning on using that metadata field as a tag but I don't think it'll hurt. Cheers
You don't need to use it as a tag everywhere on the site. As an example, take a look at how the file plugin uses the type of the file to create a categorized list: get_filetype_cloud() in http://trac.elgg.org/browser/elgg/branches/1.7/mod/file/start.php
It registers that metadata name as a tag just for that call.
@Trajan,
Take a look at hypeLiveSearch. I've done some modifications to autocomplete and its page_handler. Perhaps you can gather some ideas there.
@both: thanks for the thoughts.
@ihayredinov: I've found your new case for objects (just what I was looking for). What's the coding needed in the hypeautocomplete view for match_on to select a specific subtype?
''match_on' => 'objects' ??????
Update: Solved it with the following code. Thanks again to both of you guys.
case 'words':
// don't return results if groups aren't enabled.
$query = "SELECT * FROM {$CONFIG->dbprefix}objects_entity as oe, {$CONFIG->dbprefix}entities as e
WHERE e.guid = oe.guid
AND e.enabled = 'yes'
$owner_where
AND e.subtype = '43'
AND (oe.title LIKE '$q%' OR oe.description LIKE '%$q%')
LIMIT $limit
";
if ($entities = get_data($query)) {
foreach ($entities as $entity) {
$json = json_encode(array(
'type' => 'object',
'subtype' => 'word',
'name' => $entity->title,
'desc' => elgg_get_excerpt(strip_tags($entity->description), 30),
'icon' => '',
'guid' => $entity->guid
));
//$results[$entity->name . rand(1,100)] = "$json|{$entity->guid}";
$results[$entity->title . rand(1, 100)] = $json;
}
}
break;
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.