1. #11
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    Quote Originally Posted by khebs@live.com View Post
    in your direct controller, it should be:

    Code:
    $this->extdapi->add(
      array(
        'Echo' => array('prefix' => 'Class_'),
        'Exception' => array('prefix' => 'Class_')
      )
    );
    where is the difference?

  2. #12
    Sencha User khebs@live.com's Avatar
    Join Date
    Mar 2008
    Posts
    83
    Vote Rating
    0
    khebs@live.com is on a distinguished road

      0  

    Default


    goachka, in your zip file its:

    Code:
    <?php
    
    class Direct extends Controller {
    
    	function Direct()
    	{
    		parent::Controller();
    		$this->load->library('extdapi');
    		$this->load->library('extdcacheprovider', array('filePath' => 'cache/api_cache.txt'));
    	}
    	
    	function api($output = true)
    	{
    		$this->extdapi->setRouterUrl('/direct/router'); // default
    		$this->extdapi->setCacheProvider($this->extdcacheprovider);
    		$this->extdapi->setNamespace('Ext.app');
    		$this->extdapi->setDescriptor('Ext.app.REMOTING_API');
    		$this->extdapi->setDefaults(array(
    		    'autoInclude' => true,
    		    'basePath' => 'libraries'
    		));
    		
    		$api->add(
    			array(
    				'Echo' => array('prefix' => 'Class_'),
    				'Exception' => array('prefix' => 'Class_'),
    				'Time',
    				'File'
    			)
    		);
    
    		if($output) $this->extdapi->output();
    		$this->session->set_userdata(array('ext-direct-state' => $this->extdapi->getState()));
    	}
    	
    	function router()
    	{
    		if(!$this->session->userdata('ext-direct-state')) {
    			$this->api(false);
    		}
    		$this->load->library('extdrouter', array('api' => $this->extdapi));
    		$this->extdrouter->dispatch();
    		$this->extdrouter->getResponse(true);
    	}
    }

  3. #13
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    oh! of cause!
    strange... i'm using the correct code myself
    thanks, khebs!
    i've updated .zip file

  4. #14
    Sencha User
    Join Date
    Aug 2007
    Posts
    44
    Vote Rating
    0
    cherbert is on a distinguished road

      0  

    Default


    ok. I now have another issue and I'm tearing my hair out!

    Trying to just use the demo classes. Ext is firing off to the router ok with action = 'Time' and method = 'get'

    Code:
    {"action":"Time","method":"get","data":null,"type":"rpc","tid":2}

    The response code coming back from the router is..

    Code:
    {"type":"exception","tid":2,"message":"Call to undefined class: Time","where":"#0 \/data\/www.businessnetwork.co.uk\/system\/application\/libraries\/extdrouter.php(62): ExtDRouter->rpc(Object(stdClass))\n#1 \/data\/www.businessnetwork.co.uk\/system\/application\/controllers\/direct.php(90): ExtDRouter->dispatch()\n#2 \/data\/www.businessnetwork.co.uk\/system\/codeigniter\/CodeIgniter.php(236): Direct->router()\n#3 \/data\/www.businessnetwork.co.uk\/index.php(228): require_once('\/data\/www.busin...')\n#4 {main}"}

    I have all the demo classes in my libraries folder. And here is my direct.php

    Code:
    class Direct extends Controller {
    
    	function Direct()
    	{
    		parent::Controller();
    		$this->load->library('extdapi');
    		$this->load->library('session');
    
    		$this->load->library('extdcacheprovider', array('filePath' => 'cache/api_cache.txt'));
    	}
    	
    	function api($output = true)
    	{
    		$this->extdapi->setRouterUrl('/direct/router'); // default
    		$this->extdapi->setCacheProvider($this->extdcacheprovider);
    		$this->extdapi->setNamespace('Application');
    		$this->extdapi->setDescriptor('Application.REMOTING_API');
    		$this->extdapi->setDefaults(array(
    		    'autoInclude' => true,
    		    'basePath' => 'libraries'
    		));
    		
    		$this->extdapi->add(
    			array(
    				'Echo' => array('prefix' => 'Class_'),
    				'Exception' => array('prefix' => 'Class_'),
    				'Time',
    				'File'
    			)
    		);
    
    		if($output) {
    			$this->extdapi->output();	
    		}
    		$this->session->set_userdata(array('ext-direct-state' => $this->extdapi->getState()));
    	}
    	
    	function router()
    	{
    		if(!$this->session->userdata('ext-direct-state')) {
    			$this->api(false);
    		}
    		$this->load->library('extdrouter', array('api' => $this->extdapi));
    		$this->extdrouter->dispatch();
    		$this->extdrouter->getResponse(true);
    	}
    }

    Any suggestions please?

  5. #15
    Ext User
    Join Date
    Jul 2009
    Posts
    3
    Vote Rating
    0
    rahulswarnkar is on a distinguished road

      0  

    Default


    Hi goachka, Many thanks for this I had the same "Undefined variable: api" problem initially, but figured that out somehow.

    Quote Originally Posted by goachka View Post
    P.S. This code doesn't work on Windows platform, because of backslashes in win paths.. something should be updated...
    Mine is working on Windows

  6. #16
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    Quote Originally Posted by rahulswarnkar View Post
    Hi goachka, Many thanks for this I had the same "Undefined variable: api" problem initially, but figured that out somehow.



    Mine is working on Windows
    You can comment those lines:
    33 $this->session->set_userdata(array('ext-direct-state' => $this->extdapi->getState()));
    38 if(!$this->session->userdata('ext-direct-state')) {
    40 }

    This is not good, but it will work. Data will not be stored in session variable and will be generated every time direct/router is called.
    I will try to correct code for windows soon, so it will work with sessions.

  7. #17
    Ext User
    Join Date
    Jul 2009
    Posts
    3
    Vote Rating
    0
    rahulswarnkar is on a distinguished road

      0  

    Lightbulb


    Oh yes, of course I had to make the following change in direct.php

    PHP Code:
    $this->extdapi->setRouterUrl('direct/router'); // default 
    to
    PHP Code:
    $this->extdapi->setRouterUrl(site_url('direct/router')); // default 

  8. #18
    Ext User
    Join Date
    Jul 2009
    Posts
    3
    Vote Rating
    0
    rahulswarnkar is on a distinguished road

      0  

    Thumbs up


    Quote Originally Posted by goachka View Post
    You can comment those lines:
    33 $this->session->set_userdata(array('ext-direct-state' => $this->extdapi->getState()));
    38 if(!$this->session->userdata('ext-direct-state')) {
    40 }

    This is not good, but it will work. Data will not be stored in session variable and will be generated every time direct/router is called.
    I will try to correct code for windows soon, so it will work with sessions.
    Thanks goachka, awaiting your updated code

  9. #19
    Ext User
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    21
    Vote Rating
    0
    Julio Betta is on a distinguished road

      0  

    Default


    hey guys..
    I've tested the example classes inside the libraries folder and everything worked great..
    however, I need to set 'controllers' folder as default basePath .. but when a call a method, every time it throws an exception.
    Code:
    "Call to  undefined class: Time"
    here is my direct.php

    Code:
    class Direct extends Controller {
    
        function Direct()
        {
            parent::Controller();
            $this->load->library('extdapi');
            $this->load->library('extdcacheprovider', array('filePath'  => 'cache/api_cache.txt'));
        }
        
        function api($output = true)
        {
            $this->extdapi->setRouterUrl(site_url('direct/router'));  // default
             $this->extdapi->setCacheProvider($this->extdcacheprovider);
            $this->extdapi->setNamespace('Application');
            $this->extdapi->setDescriptor('Application.REMOTING_API');
            $this->extdapi->setDefaults(array(
                'autoInclude' => true,
                'basePath' => 'controllers'
            ));
            
            $this->extdapi->add(
                array(                
                               'Syndrome',
                               'Time'
                )
            );
    
            if($output) $this->extdapi->output();
            $this->session->set_userdata(array('ext-direct-state'  => $this->extdapi->getState()));
        }
        
        function router()
        {
            if(!$this->session->userdata('ext-direct-state')) {
                $this->api(false);
            }
            $this->load->library('extdrouter', array('api' =>  $this->extdapi));
            $this->extdrouter->dispatch();
            $this->extdrouter->getResponse(true);
        }
    }
    PS. the file Time.php is in 'controllers' folder.

  10. #20
    Ext User
    Join Date
    Apr 2009
    Posts
    9
    Vote Rating
    0
    goachka is on a distinguished road

      0  

    Default


    Time.php should be in the libraries folder

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi