Thursday, August 29, 2013

AJAX Implementation in Kohana 3.3

AJAX Implementation in Kohana 3.3

application\classes\Controller\Ajax.php

Class Controller_AjaxDemo extends Controller_SiteWise_Protected
{
   public function action_callme()
    {
        if ($this->request->is_ajax())
        {
     // do something
            echo json_encode(array('test' => 1,'test2' =>2));
        }
        else
        {
     // do something
            echo "HI";
        }
 $this->auto_render = FALSE;
    }
}

In you template file e.g. ajax.tpl


<div id="div1"><h2>Will be replaced by Ajax call</h2></div>
<script> $.ajax({ url:"AjaxDemo/callme", success:function(result){ $("#div1").html(result) } }); </script>





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'};
    
    

Monday, August 12, 2013

CRON JOB for Executing Remote PHP File


In Linux server

root account login

# crontab -e

type : curl --silent http://www.example.com/schedulerTest/add.php

save - :w

quit - :q

# crontab -l

If cron service has not start, use the following command:

/sbin/service crond start

Wednesday, August 7, 2013

Kohana 3.3 Smarty 3 Fix Template Not Found TPL Not Found

Change Case according to the following instruction.
\htdocs\kohanaLinux\modules\smarty3\classes\
└─Kohana
│ └─Smarty
│   └─Helper.php
└─Smarty
│ └─Helper.php
│ └─View.php
View.php