实际上我试图在没有链接到db的情况下创建搜索功能。所以我只是把它放在模特身上。现在我不知道如何在控制器中调用该数据。希望任何人都能解决我的问题。
这是我的观点页面:
<li>Category:
<div>
<? echo form_dropdown('fcategory', $content_category); ?> </div></li>
<li> Channel:<div>
<? echo form_dropdown('fchannel', $content_channel); ?></div> </li>
<li> Language<div>
<? echo form_dropdown('flanguage', $content_language); ?></div> </li>
<input type="submit" class="btn" name="search" value="Search" /> <span class="lightfont"></span>
这是我的模特:
function general(){
$data['content_category'] = array(
"Dramas"=>"Dramas",
"Movies"=>"Movies",
"News"=>"News",
"Anime"=>"Anime",
"Popular Selection"=>"Popular Selection"
);
$data['content_channel'] = array(
"China"=>"China",
"Hong Kong"=>"Hong Kong",
"Taiwan"=>"Taiwan",
"Japan"=>"Japan",
"Korea"=>"Korea",
"UK"=>"UK",
"US"=>"US",
"Indonesia"=>"Indonesia"
);
$data['content_language'] = array(
"English"=>"English",
"Chinese"=>"Chinese",
"Others"=>"Others"
);
return $data;
}
function sample_data(){
$TVContent ['China']['Chinese']['Movies'][1]= array ('title'=>'Gooddrama','home-index-china movies', 'English', 'Grey');
$TVContent ['China']['Chinese']['Drama'][2]= array ('title'=>'Gooddrama','home-index-china drama', 'English', 'Grey');
$TVContent ['China']['English']['Sport'][3]= array ('title'=>'ABO','', 'English', 'Grey');
$TVContent ['China']['Chinese']['News'][4]= array ('title'=>'KTD','', 'Chinese', 'Grey');
$TVContent ['China']['Chinese']['Movies'][1]['title'];
}
答案 0 :(得分:0)
使用数据库存储数据将是最佳实现
这是如何从控制器调用模型功能
//加载模型
$这 - &GT;负载&GT;模型( 'product_model');
//调用模型函数
$这 - &GT; product_model-&GT; your_function();
欲了解更多信息, http://codeigniter.com/user_guide/general/models.html