How Add Pagination With Retful Web Service

hi i developing android app u sing yii restful api

i gonna add Android ListView with Load More Button( u

like this tutorial

i want sent data using RESTFUL like in this tutorial(XML list)

how make it

[color="#FF0000"]i use this web service[/color]

http://www.yiiframework.com/wiki/175/how-to-create-a-rest-api/

this is my restful

<?php

/**

*/

/**

  • ApiController

*/

class ApiController extends Controller

{

// {{{ *** Members ***


/**


 * Key which has to be in HTTP USERNAME and PASSWORD headers 


 */


Const APPLICATION_ID = 'ASCCPE';





private &#036;format = 'json';


// }}} 


// {{{ filters


/**


 * @return array action filters


 */


public function filters()


{


        return array();


} // }}} 


// {{{ *** Actions ***


// {{{ actionIndex


public function actionIndex()


{


    echo CJSON::encode(array(1, 2, 3));


} // }}} 


// {{{ actionList

public function actionList()

{


    //&#036;this-&gt;_checkAuth();


    switch(&#036;_GET['model'])


    {


        case 'places': // {{{

//get list of places related with city_id in places table

  if (isset(&#036;_GET['cityid']))


  {


 &#036;Criteria = new CDbCriteria();


 &#036;Criteria-&gt;condition = sprintf(&quot;city_id = %s&quot;, &#036;_GET['cityid']);


&#036;models = Cities::model()-&gt;findAll(&#036;Criteria);





}else{


 &#036;models = Places::model()-&gt;findAll();


}


            break; // }}}

case ‘cities’: // {{{

//get list of places related with city_id in cities table 


    if (isset(&#036;_GET['cityid']))


  {


 &#036;Criteria = new CDbCriteria();


 &#036;Criteria-&gt;condition = sprintf(&quot;city_id = %s&quot;, &#036;_GET['cityid']);


&#036;models = Places::model()-&gt;findAll(&#036;Criteria);





}


  





&#036;models = Cities::model()-&gt;findby(&#036;Criteria);  





}





else{


   


            &#036;models = Cities::model()-&gt;findAll();


}


            break; // }}} 

case ‘hotels’: // {{{

   //get list of places related with hotel_id in hotels table 


   if (isset(&#036;_GET['hotelid']))


  {


 &#036;Criteria = new CDbCriteria();


 &#036;Criteria-&gt;condition = sprintf(&quot;hotel_id = %s&quot;, &#036;_GET['hotelid']);


&#036;models = Places::model()-&gt;findAll(&#036;Criteria);





}





else{


   


   


            &#036;models = Hotels::model()-&gt;findAll();


}


            break; // }}}

case ‘Category’: // {{{

    //get list of type_places related with id in Catagory table


    if (isset(&#036;_GET['Categoryid']))


  {


 &#036;Criteria = new CDbCriteria();


 &#036;Criteria-&gt;condition = sprintf(&quot;catagory_id = %s&quot;, &#036;_GET['Categoryid']);


&#036;models = TypePlaces::model()-&gt;findAll(&#036;Criteria);





}else{


            &#036;models = Category::model()-&gt;findAll();


}


            break; // }}}

case ‘Country’: // {{{

            &#036;models = Country::model()-&gt;findAll();


            break; // }}}

case ‘Provinces’: // {{{

            &#036;models = Provinces::model()-&gt;findAll();


            break; // }}}

case ‘Rate’: // {{{

            &#036;models = Rate::model()-&gt;findAll();


            break; // }}}

case ‘TypeHotel’: // {{{

            &#036;models = TypeHotel::model()-&gt;findAll();


            break; // }}}

case ‘TypePlaces’: // {{{

//

         //get list of places related with id in TypePlaces table    


    if (isset(&#036;_GET['typeplacesid']))


  {


 &#036;Criteria = new CDbCriteria();


 &#036;Criteria-&gt;condition = sprintf(&quot;id = %s&quot;, &#036;_GET['typeplacesid']);


&#036;models = Places::model()-&gt;findAll(&#036;Criteria);





}





else{


 &#036;models = TypePlaces::model()-&gt;findAll();


}         


            break; // }}}				


        default: // {{{ 


            &#036;this-&gt;_sendResponse(501, sprintf('Error: Mode &lt;b&gt;list&lt;/b&gt; is not implemented for model &lt;b&gt;%s&lt;/b&gt;',&#036;_GET['model']) );


            exit; // }}} 


    }


    if(is_null(&#036;models)) {


        &#036;this-&gt;_sendResponse(200, sprintf('No items where found for model &lt;b&gt;%s&lt;/b&gt;', &#036;_GET['model']) );


    } else {


        &#036;rows = array();


        foreach(&#036;models as &#036;model)


            &#036;rows[] = &#036;model-&gt;attributes;





        &#036;this-&gt;_sendResponse(200, CJSON::encode(&#036;rows),&quot;application/json&quot;);


    }


} // }}}


// {{{ actionView


/* Shows a single item


 * 


 * @access public


 * @return void


 */


public function actionView()


{


    //&#036;this-&gt;_checkAuth();


    // Check if id was submitted via GET


    if(&#33;isset(&#036;_GET['id']))


        &#036;this-&gt;_sendResponse(500, 'Error: Parameter &lt;b&gt;id&lt;/b&gt; is missing' );





    switch(&#036;_GET['model'])


    {


        // Find respective model    


        case 'places': // {{{ 


        	


            &#036;model = Places::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}} 


	    case 'cities': // {{{ 


            &#036;model = Cities::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}} 


		case 'hotels': // {{{ 


            &#036;model = Hotels::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}} 


		 case 'Category': // {{{ 


        	


            &#036;model = Category::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}}


		case 'Country': // {{{ 


        	


            &#036;model = Country::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}}


		case 'Provinces': // {{{ 


        	


            &#036;model = Provinces::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}}


        case 'Rate': // {{{ 


        	


            &#036;model = Rate::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}}


         case 'TypeHotel': // {{{ 


        	


            &#036;model = TypeHotel::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}}


        case 'TypePlaces': // {{{ 


        	


            &#036;model = TypePlaces::model()-&gt;findByPk(&#036;_GET['id']);


            break; // }}}				


        default: // {{{ 


            &#036;this-&gt;_sendResponse(501, sprintf('Mode &lt;b&gt;view&lt;/b&gt; is not implemented for model &lt;b&gt;%s&lt;/b&gt;',&#036;_GET['model']) );


            exit; // }}} 


    }


    if(is_null(&#036;model)) {


        &#036;this-&gt;_sendResponse(404, 'No Item found with id '.&#036;_GET['id']);


    } else {


        &#036;this-&gt;_sendResponse(200, &#036;this-&gt;_getObjectEncoded(&#036;_GET['model'], &#036;model-&gt;attributes));


    }


} // }}} 


// {{{ actionCreate


/**


 * Creates a new item


 * 


 * @access public


 * @return void


 */


public function actionCreate()


{


    //&#036;this-&gt;_checkAuth();





    switch(&#036;_GET['model'])


    {


        // Get an instance of the respective model


        case 'places': // {{{ 


            &#036;model = new Places;                    


            break; // }}} 


		case 'cities': // {{{ 


            &#036;model = new Cities;                    


            break; // }}} 


		case 'hotels': // {{{ 


            &#036;model = new Hotels;                    


            break; // }}} 


		 case 'Category': // {{{ 


            &#036;model = new Category;                    


            break; // }}} 


		 case 'Country': // {{{ 


            &#036;model = new Country;                    


            break; // }}} 


         case 'Provinces': // {{{ 


            &#036;model = new Provinces;                    


            break; // }}}


         case 'Rate': // {{{ 


            &#036;model = new Rate;                    


            break; // }}}


         case 'TypeHotel': // {{{ 


            &#036;model = new TypeHotel;                    


            break; // }}}


         case 'TypePlaces': // {{{ 


            &#036;model = new TypePlaces;                    


            break; // }}}				


        default: // {{{ 


            &#036;this-&gt;_sendResponse(501, sprintf('Mode &lt;b&gt;create&lt;/b&gt; is not implemented for model &lt;b&gt;%s&lt;/b&gt;',&#036;_GET['model']) );


            exit; // }}} 


    }


    // Try to assign POST values to attributes


    foreach(&#036;_POST as &#036;var=&gt;&#036;value) {


        // Does the model have this attribute?


        if(&#036;model-&gt;hasAttribute(&#036;var)) {


            &#036;model-&gt;&#036;var = &#036;value;


        } else {


            // No, raise an error


            &#036;this-&gt;_sendResponse(500, sprintf('Parameter &lt;b&gt;%s&lt;/b&gt; is not allowed for model &lt;b&gt;%s&lt;/b&gt;', &#036;var, &#036;_GET['model']) );


        }


    }


    // Try to save the model


    if(&#036;model-&gt;save()) {


        // Saving was OK


        &#036;this-&gt;_sendResponse(200, &#036;this-&gt;_getObjectEncoded(&#036;_GET['model'], &#036;model-&gt;attributes) );


    } else {


        // Errors occurred


        &#036;msg = &quot;&lt;h1&gt;Error&lt;/h1&gt;&quot;;


        &#036;msg .= sprintf(&quot;Couldn't create model &lt;b&gt;%s&lt;/b&gt;&quot;, &#036;_GET['model']);


        &#036;msg .= &quot;&lt;ul&gt;&quot;;


        foreach(&#036;model-&gt;errors as &#036;attribute=&gt;&#036;attr_errors) {


            &#036;msg .= &quot;&lt;li&gt;Attribute: &#036;attribute&lt;/li&gt;&quot;;


            &#036;msg .= &quot;&lt;ul&gt;&quot;;


            foreach(&#036;attr_errors as &#036;attr_error) {


                &#036;msg .= &quot;&lt;li&gt;&#036;attr_error&lt;/li&gt;&quot;;


            }        


            &#036;msg .= &quot;&lt;/ul&gt;&quot;;


        }


        &#036;msg .= &quot;&lt;/ul&gt;&quot;;


        &#036;this-&gt;_sendResponse(500, &#036;msg );


    }





    var_dump(&#036;_REQUEST);


} // }}}     


// {{{ actionUpdate


/**


 * Update a single iten


 * 


 * @access public


 * @return void


 */


public function actionUpdate()


{


    &#036;this-&gt;_checkAuth();





    // Get PUT parameters


    parse_str(file_get_contents('php://input'), &#036;put_vars);





    switch(&#036;_GET['model'])


    {


        // Find respective model


        case 'places': // {{{ 


            &#036;model = Places::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


        case 'cities': // {{{ 


            &#036;model = Cities::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


		case 'hotels': // {{{ 


            &#036;model = Hotels::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


		case 'Category': // {{{ 


            &#036;model = Category::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


        case 'Country': // {{{ 


            &#036;model = Country::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


        case 'Provinces': // {{{ 


            &#036;model = Provinces::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


        case 'Rate': // {{{ 


            &#036;model = Rate::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}	


        case 'TypeHotel': // {{{ 


            &#036;model = TypeHotel::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}


        case 'TypePlaces': // {{{ 


            &#036;model = TypePlaces::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}				


        default: // {{{ 


            &#036;this-&gt;_sendResponse(501, sprintf('Error: Mode &lt;b&gt;update&lt;/b&gt; is not implemented for model &lt;b&gt;%s&lt;/b&gt;',&#036;_GET['model']) );


            exit; // }}} 


    }


    if(is_null(&#036;model))


        &#036;this-&gt;_sendResponse(400, sprintf(&quot;Error: Didn't find any model &lt;b&gt;%s&lt;/b&gt; with ID &lt;b&gt;%s&lt;/b&gt;.&quot;,&#036;_GET['model'], &#036;_GET['id']) );


    


    // Try to assign PUT parameters to attributes


    foreach(&#036;put_vars as &#036;var=&gt;&#036;value) {


        // Does model have this attribute?


        if(&#036;model-&gt;hasAttribute(&#036;var)) {


            &#036;model-&gt;&#036;var = &#036;value;


        } else {


            // No, raise error


            &#036;this-&gt;_sendResponse(500, sprintf('Parameter &lt;b&gt;%s&lt;/b&gt; is not allowed for model &lt;b&gt;%s&lt;/b&gt;', &#036;var, &#036;_GET['model']) );


        }


    }


    // Try to save the model


    if(&#036;model-&gt;save()) {


        &#036;this-&gt;_sendResponse(200, sprintf('The model &lt;b&gt;%s&lt;/b&gt; with id &lt;b&gt;%s&lt;/b&gt; has been updated.', &#036;_GET['model'], &#036;_GET['id']) );


    } else {


        &#036;msg = &quot;&lt;h1&gt;Error&lt;/h1&gt;&quot;;


        &#036;msg .= sprintf(&quot;Couldn't update model &lt;b&gt;%s&lt;/b&gt;&quot;, &#036;_GET['model']);


        &#036;msg .= &quot;&lt;ul&gt;&quot;;


        foreach(&#036;model-&gt;errors as &#036;attribute=&gt;&#036;attr_errors) {


            &#036;msg .= &quot;&lt;li&gt;Attribute: &#036;attribute&lt;/li&gt;&quot;;


            &#036;msg .= &quot;&lt;ul&gt;&quot;;


            foreach(&#036;attr_errors as &#036;attr_error) {


                &#036;msg .= &quot;&lt;li&gt;&#036;attr_error&lt;/li&gt;&quot;;


            }        


            &#036;msg .= &quot;&lt;/ul&gt;&quot;;


        }


        &#036;msg .= &quot;&lt;/ul&gt;&quot;;


        &#036;this-&gt;_sendResponse(500, &#036;msg );


    }


} // }}} 


// {{{ actionDelete


/**


 * Deletes a single item


 * 


 * @access public


 * @return void


 */


public function actionDelete()


{


    //&#036;this-&gt;_checkAuth();





    switch(&#036;_GET['model'])


    {


        // Load the respective model


        case 'places': // {{{ 


            &#036;model = Places::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


		case 'cities': // {{{ 


            &#036;model = Cities::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


		case 'hotels': // {{{ 


            &#036;model = Hotels::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


		case 'Category': // {{{ 


            &#036;model = Category::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 


        case 'Country': // {{{ 


            &#036;model = Country::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}} 	


        case 'Provinces': // {{{ 


            &#036;model = Provinces::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}


		case 'Rate': // {{{ 


            &#036;model = Rate::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}


         case 'TypeHotel': // {{{ 


            &#036;model = TypeHotel::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}


        case 'TypePlaces': // {{{ 


            &#036;model = TypePlaces::model()-&gt;findByPk(&#036;_GET['id']);                    


            break; // }}}				


        default: // {{{ 


            &#036;this-&gt;_sendResponse(501, sprintf('Error: Mode &lt;b&gt;delete&lt;/b&gt; is not implemented for model &lt;b&gt;%s&lt;/b&gt;',&#036;_GET['model']) );


            exit; // }}} 


    }


    // Was a model found?


    if(is_null(&#036;model)) {


        // No, raise an error


        &#036;this-&gt;_sendResponse(400, sprintf(&quot;Error: Didn't find any model &lt;b&gt;%s&lt;/b&gt; with ID &lt;b&gt;%s&lt;/b&gt;.&quot;,&#036;_GET['model'], &#036;_GET['id']) );


    }





    // Delete the model


    &#036;num = &#036;model-&gt;delete();


    if(&#036;num&gt;0)


        &#036;this-&gt;_sendResponse(200, sprintf(&quot;Model &lt;b&gt;%s&lt;/b&gt; with ID &lt;b&gt;%s&lt;/b&gt; has been deleted.&quot;,&#036;_GET['model'], &#036;_GET['id']) );


    else


        &#036;this-&gt;_sendResponse(500, sprintf(&quot;Error: Couldn't delete model &lt;b&gt;%s&lt;/b&gt; with ID &lt;b&gt;%s&lt;/b&gt;.&quot;,&#036;_GET['model'], &#036;_GET['id']) );


} // }}} 


// }}} End Actions


// {{{ Other Methods


// {{{ _sendResponse


/**


 * Sends the API response 


 * 


 * @param int &#036;status 


 * @param string &#036;body 


 * @param string &#036;content_type 


 * @access private


 * @return void


 */


private function _sendResponse(&#036;status = 200, &#036;body = '', &#036;content_type = 'text/html')


{


    &#036;status_header = 'HTTP/1.1 ' . &#036;status . ' ' . &#036;this-&gt;_getStatusCodeMessage(&#036;status);


    // set the status


    header(&#036;status_header);


    // set the content type


    header('Content-type: ' . &#036;content_type);





    // pages with body are easy


    if(&#036;body &#33;= '')


    {


        // send the body


        echo &#036;body;


        exit;


    }


    // we need to create the body if none is passed


    else


    {


        // create some body messages


        &#036;message = '';





        // this is purely optional, but makes the pages a little nicer to read


        // for your users.  Since you won't likely send a lot of different status codes,


        // this also shouldn't be too ponderous to maintain


        switch(&#036;status)


        {


            case 401:


                &#036;message = 'You must be authorized to view this page.';


                break;


            case 404:


                &#036;message = 'The requested URL ' . &#036;_SERVER['REQUEST_URI'] . ' was not found.';


                break;


            case 500:


                &#036;message = 'The server encountered an error processing your request.';


                break;


            case 501:


                &#036;message = 'The requested method is not implemented.';


                break;


        }





        // servers don't always have a signature turned on (this is an apache directive &quot;ServerSignature On&quot;)


        &#036;signature = (&#036;_SERVER['SERVER_SIGNATURE'] == '') ? &#036;_SERVER['SERVER_SOFTWARE'] . ' Server at ' . &#036;_SERVER['SERVER_NAME'] . ' Port ' . &#036;_SERVER['SERVER_PORT'] : &#036;_SERVER['SERVER_SIGNATURE'];





        // this should be templatized in a real-world solution


        &#036;body = '&lt;&#33;DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;


                    &lt;html&gt;


                        &lt;head&gt;


                            &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;


                            &lt;title&gt;' . &#036;status . ' ' . &#036;this-&gt;_getStatusCodeMessage(&#036;status) . '&lt;/title&gt;


                        &lt;/head&gt;


                        &lt;body&gt;


                            &lt;h1&gt;' . &#036;this-&gt;_getStatusCodeMessage(&#036;status) . '&lt;/h1&gt;


                            &lt;p&gt;' . &#036;message . '&lt;/p&gt;


                            &lt;hr /&gt;


                            &lt;address&gt;' . &#036;signature . '&lt;/address&gt;


                        &lt;/body&gt;


                    &lt;/html&gt;';





        echo &#036;body;


        exit;


    }


} // }}}            


// {{{ _getStatusCodeMessage


/**


 * Gets the message for a status code


 * 


 * @param mixed &#036;status 


 * @access private


 * @return string


 */


private function _getStatusCodeMessage(&#036;status)


{


    // these could be stored in a .ini file and loaded


    // via parse_ini_file()... however, this will suffice


    // for an example


    &#036;codes = Array(


        100 =&gt; 'Continue',


        101 =&gt; 'Switching Protocols',


        200 =&gt; 'OK',


        201 =&gt; 'Created',


        202 =&gt; 'Accepted',


        203 =&gt; 'Non-Authoritative Information',


        204 =&gt; 'No Content',


        205 =&gt; 'Reset Content',


        206 =&gt; 'Partial Content',


        300 =&gt; 'Multiple Choices',


        301 =&gt; 'Moved Permanently',


        302 =&gt; 'Found',


        303 =&gt; 'See Other',


        304 =&gt; 'Not Modified',


        305 =&gt; 'Use Proxy',


        306 =&gt; '(Unused)',


        307 =&gt; 'Temporary Redirect',


        400 =&gt; 'Bad Request',


        401 =&gt; 'Unauthorized',


        402 =&gt; 'Payment Required',


        403 =&gt; 'Forbidden',


        404 =&gt; 'Not Found',


        405 =&gt; 'Method Not Allowed',


        406 =&gt; 'Not Acceptable',


        407 =&gt; 'Proxy Authentication Required',


        408 =&gt; 'Request Timeout',


        409 =&gt; 'Conflict',


        410 =&gt; 'Gone',


        411 =&gt; 'Length Required',


        412 =&gt; 'Precondition Failed',


        413 =&gt; 'Request Entity Too Large',


        414 =&gt; 'Request-URI Too Long',


        415 =&gt; 'Unsupported Media Type',


        416 =&gt; 'Requested Range Not Satisfiable',


        417 =&gt; 'Expectation Failed',


        500 =&gt; 'Internal Server Error',


        501 =&gt; 'Not Implemented',


        502 =&gt; 'Bad Gateway',


        503 =&gt; 'Service Unavailable',


        504 =&gt; 'Gateway Timeout',


        505 =&gt; 'HTTP Version Not Supported'


    );





    return (isset(&#036;codes[&#036;status])) ? &#036;codes[&#036;status] : '';


} // }}} 


// {{{ _checkAuth


/**


 * Checks if a request is authorized


 * 


 * @access private


 * @return void


 */


private function _checkAuth()


{


    // Check if we have the USERNAME and PASSWORD HTTP headers set?


    if(&#33;(isset(&#036;_SERVER['HTTP_X_'.self::APPLICATION_ID.'_USERNAME']) and isset(&#036;_SERVER['HTTP_X_'.self::APPLICATION_ID.'_PASSWORD']))) {


        // Error: Unauthorized


        &#036;this-&gt;_sendResponse(401);


    }


    &#036;username = &#036;_SERVER['HTTP_X_'.self::APPLICATION_ID.'_USERNAME'];


    &#036;password = &#036;_SERVER['HTTP_X_'.self::APPLICATION_ID.'_PASSWORD'];


    // Find the user


    &#036;user=User::model()-&gt;find('LOWER(username)=?',array(strtolower(&#036;username)));


    if(&#036;user===null) {


        // Error: Unauthorized


        &#036;this-&gt;_sendResponse(401, 'Error: User Name is invalid');


    } else if(&#33;&#036;user-&gt;validatePassword(&#036;password)) {


        // Error: Unauthorized


        &#036;this-&gt;_sendResponse(401, 'Error: User Password is invalid');


    }


} // }}} 


// {{{ _getObjectEncoded


/**


 * Returns the json or xml encoded array


 * 


 * @param mixed &#036;model 


 * @param mixed &#036;array Data to be encoded


 * @access private


 * @return void


 */


private function _getObjectEncoded(&#036;model, &#036;array)


{


    if(isset(&#036;_GET['format']))


        &#036;this-&gt;format = &#036;_GET['format'];





    if(&#036;this-&gt;format=='json')


    {


        return CJSON::encode(&#036;array);


    }


    elseif(&#036;this-&gt;format=='xml')


    {


        &#036;result = '&lt;?xml version=&quot;1.0&quot;&gt;';


        &#036;result .= &quot;&#092;n&lt;&#036;model&gt;&#092;n&quot;;


        foreach(&#036;array as &#036;key=&gt;&#036;value)


            &#036;result .= &quot;    &lt;&#036;key&gt;&quot;.utf8_encode(&#036;value).&quot;&lt;/&#036;key&gt;&#092;n&quot;; 


        &#036;result .= '&lt;/'.&#036;model.'&gt;';


        return &#036;result;


    }


    else


    {


        return;


    }


} // }}} 


// }}} End Other Methods

}

/* vim:set ai sw=4 sts=4 et fdm=marker fdc=4: */

?>

how make this can give example code pre one table

case ‘Country’: // {{{

            &#036;models = Country::model()-&gt;findAll();


            break; // }}}

i’ll send more data if you’ll want please thank you

how send data using web service like above tutorial