Welcome Guest, Not a member yet? Register   Sign In
Introducing...REST!
#11

[eluser]Lovecannon[/eluser]
well, I have functions that do JSON decoding/encoding,
$this->rest->jsonEncode and $this->rest->jsonDecode, just pass a variable to jsonEncode to encode it into JSON, it can be an array or object. and to decode use jsonDecode


Code:
class Api extends Controller
{
function _test($data)
    {
        $this->load->library('rest');
        echo $this->rest->jsonEncode($obj_to_encode_into_json);
    }
function rest()
{
    $this->load->library('rest');
    $this->rest->addFunction('test', '_test', 'get');          
    $this->rest->addFunction('testpost', '__test', 'post');
    $this->rest->serve($this); //You have to pass a reference to the object that has the methods. In this example, it would be the controller. */
}
}


Messages In This Thread
Introducing...REST! - by El Forum - 03-02-2008, 01:30 PM
Introducing...REST! - by El Forum - 03-09-2008, 12:42 AM
Introducing...REST! - by El Forum - 03-09-2008, 09:29 AM
Introducing...REST! - by El Forum - 03-11-2008, 11:00 AM
Introducing...REST! - by El Forum - 04-04-2008, 08:42 AM
Introducing...REST! - by El Forum - 04-04-2008, 08:32 PM
Introducing...REST! - by El Forum - 04-05-2008, 04:26 AM
Introducing...REST! - by El Forum - 04-05-2008, 05:48 AM
Introducing...REST! - by El Forum - 04-05-2008, 06:38 AM
Introducing...REST! - by El Forum - 04-05-2008, 09:55 AM
Introducing...REST! - by El Forum - 04-05-2008, 10:12 PM
Introducing...REST! - by El Forum - 04-06-2008, 03:46 AM
Introducing...REST! - by El Forum - 04-06-2008, 09:48 AM
Introducing...REST! - by El Forum - 04-06-2008, 09:48 AM
Introducing...REST! - by El Forum - 06-14-2008, 06:54 PM
Introducing...REST! - by El Forum - 06-14-2008, 07:09 PM
Introducing...REST! - by El Forum - 06-16-2008, 12:55 PM
Introducing...REST! - by El Forum - 06-18-2008, 09:34 AM
Introducing...REST! - by El Forum - 06-20-2008, 11:32 AM
Introducing...REST! - by El Forum - 06-23-2008, 04:59 PM
Introducing...REST! - by El Forum - 07-01-2008, 06:57 PM
Introducing...REST! - by El Forum - 07-01-2008, 07:51 PM
Introducing...REST! - by El Forum - 07-04-2008, 02:49 PM
Introducing...REST! - by El Forum - 07-04-2008, 04:00 PM
Introducing...REST! - by El Forum - 08-01-2008, 08:57 PM
Introducing...REST! - by El Forum - 10-02-2008, 06:42 PM
Introducing...REST! - by El Forum - 10-15-2008, 10:05 PM
Introducing...REST! - by El Forum - 10-21-2008, 07:17 PM
Introducing...REST! - by El Forum - 11-03-2008, 10:23 PM
Introducing...REST! - by El Forum - 05-24-2009, 04:41 AM
Introducing...REST! - by El Forum - 09-10-2009, 11:24 AM
Introducing...REST! - by El Forum - 03-24-2010, 11:51 AM
Introducing...REST! - by El Forum - 03-24-2010, 01:57 PM
Introducing...REST! - by El Forum - 03-24-2010, 02:18 PM
Introducing...REST! - by El Forum - 05-31-2010, 09:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB