本文整理汇总了PHP中CI::load方法的典型用法代码示例。如果您正苦于以下问题:PHP CI::load方法的具体用法?PHP CI::load怎么用?PHP CI::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI
的用法示例。
在下文中一共展示了CI::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
\CI::auth()->check_access('Admin', true);
\CI::load()->model(['Categories', 'Products', 'Pages']);
\CI::lang()->load('sitemap');
}
示例2: index
public function index($slug, $sort = 'id', $dir = "ASC", $page = 0)
{
\CI::lang()->load('categories');
//define the URL for pagination
$pagination_base_url = site_url('category/' . $slug . '/' . $sort . '/' . $dir);
//how many products do we want to display per page?
//this is configurable from the admin settings page.
$per_page = config_item('products_per_page');
//grab the categories
$categories = \CI::Categories()->get($slug, $sort, $dir, $page, $per_page);
//no category? show 404
if (!$categories) {
throw_404();
return;
}
$categories['sort'] = $sort;
$categories['dir'] = $dir;
$categories['slug'] = $slug;
$categories['page'] = $page;
//load up the pagination library
\CI::load()->library('pagination');
$config['base_url'] = $pagination_base_url;
$config['uri_segment'] = 5;
$config['per_page'] = $per_page;
$config['num_links'] = 3;
$config['total_rows'] = $categories['total_products'];
\CI::pagination()->initialize($config);
//load the view
$this->view('categories/category', $categories);
}
示例3: login
public function login()
{
$redirect = \CI::auth()->isLoggedIn(false, false);
if ($redirect) {
redirect('admin/dashboard');
}
\CI::load()->helper('form');
$data['redirect'] = \CI::session()->flashdata('redirect');
$submitted = \CI::input()->post('submitted');
if ($submitted) {
$username = \CI::input()->post('username');
$password = \CI::input()->post('password');
$remember = \CI::input()->post('remember');
$redirect = \CI::input()->post('redirect');
$login = \CI::auth()->login_admin($username, $password, $remember);
if ($login) {
if ($redirect == '') {
$redirect = 'admin/dashboard';
}
redirect($redirect);
} else {
//this adds the redirect back to flash data if they provide an incorrect credentials
\CI::session()->set_flashdata('redirect', $redirect);
\CI::session()->set_flashdata('error', lang('error_authentication_failed'));
redirect('admin/login');
}
}
$this->views->show('admin/header', $data);
$this->views->show('admin/login', $data);
$this->views->show('admin/footer', $data);
}
示例4: __construct
function __construct()
{
parent::__construct();
\CI::auth()->check_access('Admin', true);
\CI::load()->model(['Orders', 'Search']);
\CI::load()->helper(array('formatting'));
\CI::lang()->load('reports');
}
示例5: __construct
public function __construct()
{
parent::__construct();
\CI::auth()->check_access('Admin', true);
\CI::load()->model(['Products', 'Categories']);
\CI::load()->helper('form');
\CI::lang()->load('products');
}
示例6: __construct
public function __construct()
{
parent::__construct();
\CI::load()->model('GiftCards');
\CI::load()->helper('form');
\CI::load()->library('form_validation');
\CI::lang()->load('gift_cards');
}
示例7: lap_dat
function lap_dat()
{
\CI::load()->model(['Materials']);
$tmp = \CI::Materials()->getMaterials();
echo '<pre>';
print_r($tmp);
exit;
}
示例8: set
public function set($kVA, $phase, $gen_number)
{
\CI::load()->model(['Materials']);
$this->kVA = $kVA;
$this->phase = $phase;
$this->gen_number = $gen_number;
$this->data = \CI::Materials()->getMaterials($kVA, $gen_number);
//echo '<pre>';print_r($this->data);exit;
}
示例9: index
public function index($code = false, $page = 0)
{
$pagination_base_url = site_url('search/' . $code);
//how many products do we want to display per page?
//this is configurable from the admin settings page.
$per_page = config_item('products_per_page');
\CI::load()->model('Search');
//check to see if we have a search term
if (!$code) {
//if the term is in post, save it to the db and give me a reference
$term = \CI::input()->post('term', true);
if (empty($term)) {
//if there is still no search term throw an error
$data['error'] = lang('search_error');
$this->view('search_error', $data);
return;
} else {
$code = \CI::Search()->recordTerm($term);
// no code? redirect so we can have the code in place for the sorting.
// I know this isn't the best way...
redirect('search/' . $code . '/' . $page);
}
} else {
//if we have the md5 string, get the term
$term = \CI::Search()->getTerm($code);
}
//fix for the category view page.
$data['base_url'] = [];
$sortArray = array('name/asc' => array('by' => 'name', 'sort' => 'ASC'), 'name/desc' => array('by' => 'name', 'sort' => 'DESC'), 'price/asc' => array('by' => 'price', 'sort' => 'ASC'), 'price/desc' => array('by' => 'price', 'sort' => 'DESC'));
$sortBy = array('by' => false, 'sort' => false);
if (isset($_GET['by'])) {
if (isset($sortArray[$_GET['by']])) {
$sortBy = $sortArray[$_GET['by']];
}
}
if (empty($term)) {
//if there is still no search term throw an error
$this->view('search_error', $data);
return;
} else {
$result = \CI::Products()->search_products($term, $per_page, $page, $sortBy['by'], $sortBy['sort']);
$config['total_rows'] = $result['count'];
\CI::load()->library('pagination');
$config['base_url'] = $pagination_base_url;
$config['uri_segment'] = 3;
$config['per_page'] = $per_page;
$config['num_links'] = 3;
$config['total_rows'] = $result['count'];
\CI::pagination()->initialize($config);
$data['products'] = $result['products'];
$data['category'] = (object) ['name' => str_replace('{term}', $term, lang('search_title'))];
$this->view('categories/category', $data);
}
}
示例10: api
public function api($slug)
{
\CI::load()->language('page');
$page = $this->Page_model->slug($slug);
if (!$page) {
$json = json_encode(['error' => lang('error_page_not_found')]);
} else {
$json = json_encode($page);
}
$this->view('json', ['json' => json_encode($json)]);
}
示例11: __construct
public function __construct()
{
parent::__construct();
if (\CI::auth()->check_access('Orders')) {
redirect(config_item('admin_folder') . '/orders');
}
\CI::load()->model('Orders');
\CI::load()->model('Customers');
\CI::load()->helper('date');
\CI::lang()->load('dashboard');
}
示例12: index
public function index()
{
\CI::auth()->check_access('Admin', true);
\CI::lang()->load('settings');
\CI::load()->helper('inflector');
global $shippingModules;
$data['shipping_modules'] = $shippingModules;
$data['enabled_modules'] = \CI::Settings()->get_settings('shipping_modules');
$data['page_title'] = lang('common_shipping_modules');
$this->view('shipping_index', $data);
}
示例13: index
public function index()
{
\CI::auth()->check_access('Admin', true);
\CI::lang()->load('settings');
\CI::load()->helper('inflector');
global $paymentModules;
//Payment Information
$payment_order = \CI::Settings()->get_settings('payment_order');
$data['payment_modules'] = $paymentModules;
$data['enabled_modules'] = \CI::Settings()->get_settings('payment_modules');
$data['page_title'] = lang('common_payment_modules');
$this->view('payment_index', $data);
}
示例14: __construct
public function __construct()
{
parent::__construct();
//add the theme to the packages path
\CI::load()->add_package_path(FCPATH . 'themes/' . config_item('theme') . '/');
\CI::load()->model(array('Pages', 'Customers', 'Login', 'Categories', 'Coupons', 'Locations', 'Products', 'ProductOptions', 'DigitalProducts'));
//load in some base information
\CI::load()->helper('theme');
\CI::lang()->load('common');
$this->pages = \CI::Pages()->get_pages_tiered();
//see if the customer is logged in.
//if the customer is not logged in, then we'll have a temporary guest customer created.
$this->isLoggedIn = \CI::Login()->isLoggedIn();
}
示例15: form
public function form()
{
//this same function processes the form
\CI::load()->helper('form');
\CI::load()->library('form_validation');
\CI::form_validation()->set_rules('enabled', 'lang:enabled', 'trim|numeric');
\CI::form_validation()->set_rules('rate', 'lang:rate', 'trim|floatval');
if (\CI::form_validation()->run() == FALSE) {
$settings = \CI::Settings()->get_settings('FlatRate');
$this->view('flat_rate_form', $settings);
} else {
\CI::Settings()->save_settings('FlatRate', \CI::input()->post());
redirect('admin/shipping');
}
}