Ejemplo n.º 1
0
/**
* Returns search results of $tag keyword as a JSON string.
* @param string $tag Searches the Database for content with the given tag.
* @param integer $page The Page number for search results.
* @return string JSON String containing search results.
*/
function getTagSearchJson($tag, $page)
{
    $contentarray = content::tagSearch($tag, $page * 10 - 10, 10);
    $json = array();
    for ($i = 0; $i < count($contentarray); $i++) {
        $obj = new video($contentarray[$i]);
        array_push($json, array('cid' => $obj->getContentId(), 'title' => $obj->getTitle(), 'viewcount' => $obj->getViewCount(), 'poster' => $obj->getPoster(), 'timestamp' => $obj->getTimestamp(), 'uid' => $obj->getUserId(), 'fullname' => user::getFullNameS($obj->getUserId()), 'userpic' => user::getUserPictureS($obj->getUserId())));
    }
    return json_encode($json);
}