Closed binbin4649 closed 10 years ago
For example,
class ApiController extends AppController
{
public $components = Array('RequestHandler', 'Cookie');
public function config($action)
{
switch($action) {
case 'set_pc':
if($this->RequestHandler->isMobile()) {
$this->Cookie->write('Config.mode', 'pc', null, '30 day');
$this->redirect('/');
}
break;
case 'set_mobile':
if($this->RequestHandler->isMobile()) {
$this->Cookie->delete('Config.mode');
$this->redirect('/');
}
break;
}
$this->layout = 'api/default';
}
}
class AppController extends Controller
{
public $components = Array('RequestHandler', 'Cookie');
public function beforeFilter()
{
if($this->RequestHandler->isMobile()) {
$mode = $this->Cookie->read('Config.mode');
$this->set('mode', is_null($mode) ? '' : $mode);
if($mode !== 'pc')
$this->theme = 'Mobile';
}
}
}
http://weble.org/2012/04/30/cakephp-2-1-jquery-mobile I quoted from here. Is Japanese. Can you incorporate this?
@binbin4649 , don't worry i know how to do it, RequestHandler is a component which is used to handle various requests like RSS, AJAX, MoileView etc, just let me know when to start working on Mobile view?
For now, please be implemented in the state of now.
it is done.
785a0a4587ddff0b060459b0c496b48a8a3f222c good hack.
[sample] mobile side For pc view
PC side. For mobile view
If you click on the link of each, is switched.
Prepare 713efbf5b76e203ccf02c728ab1cb0acfbaa6f64
Reference materials https://dl.dropboxusercontent.com/u/9913763/bug/5932e01273b9f751f9c815ab120a4bf3.png https://dl.dropboxusercontent.com/u/9913763/bug/71ed9c8e8134d71d08ddbee559ef238f.png