Web サイト用に持っているものと同じモデルとコントローラーを使用し、アプリケーション ディレクトリに 2 つの個別の「Views」フォルダーを作成します。1 つは Web バージョン用、もう 1 つはモバイル バージョン用です。それ以外の場合は、デスクトップ ビューとモバイル ビューからアクセスされます。
編集: これは、Codeigniter/system/loader.php でビュー フォルダー パスを割り当てる関数です。
function __construct() {
$this->_ci_view_path = APPPATH.'views/';
$this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(APPPATH, BASEPATH);
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
log_message('debug', "Loader Class Initialized");
}
したがって、ここでこのチェックを適用すると:
if($this->agent->mobile()){
$this->_ci_view_path = APPPATH.'views/mobile_view';
}
これは行く方法ですか?–