Tuesday, August 27, 2013

crxml and kohana 3.3 integration

crxml and kohana 3.3 integration


  1. crxml.php can be downloaded here : https://github.com/sandeepcr529/crxml 
  2. put crxml.php to the following directory
    [your project]/application/vendor/crxml/
  3. Add the following code to
    [your project]/application/bootstrap.php

    if ($path = Kohana::find_file('vendor', 'crxml/crxml'))
    {
        ini_set('include_path',
        ini_get('include_path').PATH_SEPARATOR.dirname(dirname($path)));
     
        require_once 'crxml/crxml.php';
    }
    
  4. In any controller, test the installation by the following codes
    //Create a blank crXml object.
    $crxml = new crxml;
    
    //$xml_result contains the xml String
    $crxml->loadXML($xml_result); // 
     
    //Outputs the XML document e.g.
    echo $crxml->{'node1'}->{'node2'}->{'node3'}->{'node4'};
    
    

No comments: