当前位置: 首页>>代码示例>>PHP>>正文


PHP CI::Pages方法代码示例

本文整理汇总了PHP中CI::Pages方法的典型用法代码示例。如果您正苦于以下问题:PHP CI::Pages方法的具体用法?PHP CI::Pages怎么用?PHP CI::Pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI的用法示例。


在下文中一共展示了CI::Pages方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 public function generate()
 {
     $type = CI::uri()->segment(1);
     $slug = CI::uri()->segment(2);
     if (!$type || !$slug) {
         return;
         //return blank
     }
     if ($type == 'category') {
         $category = CI::Categories()->slug($slug);
         if (!$category) {
             return;
         }
         $this->trace_categories($category->id);
     } elseif ($type == 'product') {
         $product = CI::Products()->slug($slug);
         if (!$product) {
             return;
         }
         array_unshift($this->breadcrumbs, ['link' => site_url('product/' . $product->slug), 'name' => $product->name]);
         $this->trace_categories($product->primary_category);
     } elseif ($type == 'page') {
         $page = CI::Pages()->slug($slug);
         if (!$page) {
             return;
         }
         $this->trace_pages($page->id);
     }
     echo GoCart\Libraries\View::getInstance()->get('breadcrumbs', ['breadcrumbs' => $this->breadcrumbs]);
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:30,代码来源:Breadcrumbs.php

示例2: generatePages

 public function generatePages()
 {
     $pages = \CI::Pages()->get_pages_tiered();
     $xml = $this->partial('page_xml', ['pages' => $pages['all']], true);
     echo $xml;
     $file = fopen('sitemap.xml', 'a');
     fwrite($file, $xml);
     fclose($file);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:9,代码来源:AdminSitemap.php

示例3: __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();
 }
开发者ID:vandona,项目名称:v3,代码行数:14,代码来源:FrontController.php

示例4: page_loop

function page_loop($parent = 0, $ulattribs = false, $ul = true)
{
    $pages = CI::Pages()->get_pages_tiered();
    $items = false;
    if (isset($pages[$parent])) {
        $items = $pages[$parent];
    }
    if ($items) {
        echo $ul ? '<ul ' . $ulattribs . '>' : '';
        foreach ($items as $item) {
            echo '<li>';
            $chevron = ' <i class="icon-chevron-down dropdown"></i>';
            if ($item->slug == '') {
                //add the chevron if this has a drop menu
                $name = $item->title;
                if (isset($pages[$item->id])) {
                    $name .= $chevron;
                }
                $target = $item->new_window ? ' target="_blank"' : '';
                $anchor = '<a href="' . $item->url . '"' . $target . '>' . $name . '</a>';
            } else {
                //add the chevron if this has a drop menu
                $name = $item->menu_title;
                if (isset($pages[$item->id])) {
                    $name .= $chevron;
                }
                $selected = CI::uri()->segment(2) == $item->slug ? 'class="selected"' : '';
                $anchor = anchor('page/' . $item->slug, $name, $selected);
            }
            echo $anchor;
            page_loop($item->id);
            echo '</li>';
        }
        echo $ul ? '</ul>' : '';
    }
}
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:36,代码来源:theme_helper.php

示例5: index

 public function index()
 {
     \CI::load()->helper('form');
     \CI::load()->library('form_validation');
     //set defaults
     $data = ['company_name' => '', 'theme' => 'default', 'homepage' => '', 'products_per_page' => '24', 'default_meta_keywords' => '', 'default_meta_description' => '', 'sendmail_path' => '/usr/sbin/sendmail -bs', 'email_from' => '', 'email_to' => '', 'email_method' => 'Mail', 'smtp_server' => '', 'smtp_username' => '', 'smtp_password' => '', 'smtp_port' => '25', 'country_id' => '', 'city' => '', 'address1' => '', 'address2' => '', 'zone_id' => '', 'zip' => '', 'locale' => locale_get_default(), 'timezone' => date_default_timezone_get(), 'currency_iso' => 'USD', 'ssl_support' => '', 'stage_username' => '', 'stage_password' => '', 'require_login' => '', 'new_customer_status' => '1', 'weight_unit' => 'LB', 'dimension_unit' => 'IN', 'order_status' => '', 'inventory_enabled' => '', 'allow_os_purchase' => '', 'tax_address' => '', 'tax_shipping' => ''];
     \CI::form_validation()->set_rules('company_name', 'lang:company_name', 'required');
     \CI::form_validation()->set_rules('default_meta_keywords', 'lang:default_meta_keywords', 'trim|strip_tags');
     \CI::form_validation()->set_rules('default_meta_description', 'lang:default_meta_description', 'trim|strip_tags');
     \CI::form_validation()->set_rules('theme', 'lang:theme', 'required');
     \CI::form_validation()->set_rules('homepage', 'lang:select_homepage');
     \CI::form_validation()->set_rules('products_per_page', 'lang:products_per_page');
     \CI::form_validation()->set_rules('email_from', 'lang:email_from', 'required|valid_email');
     \CI::form_validation()->set_rules('email_to', 'lang:email_to', 'required|valid_email');
     \CI::form_validation()->set_rules('email_method', 'lang:email_method', 'required');
     if (\CI::input()->post('email_method') == 'smtp') {
         \CI::form_validation()->set_rules('smtp_server', 'lang:smtp_server', 'required');
         \CI::form_validation()->set_rules('smtp_username', 'lang:smtp_username', 'required');
         \CI::form_validation()->set_rules('smtp_password', 'lang:smtp_password', 'required');
         \CI::form_validation()->set_rules('smtp_port', 'lang:smtp_port', 'required');
     } elseif (\CI::input()->post('email_method') == 'sendmail') {
         \CI::form_validation()->set_rules('sendmail_path', 'lang:sendmail_path', 'required');
     }
     \CI::form_validation()->set_rules('country_id', 'lang:country');
     \CI::form_validation()->set_rules('address1', 'lang:address');
     \CI::form_validation()->set_rules('address2', 'lang:address');
     \CI::form_validation()->set_rules('zone_id', 'lang:state');
     \CI::form_validation()->set_rules('zip', 'lang:zip');
     \CI::form_validation()->set_rules('locale', 'lang:locale', 'required');
     \CI::form_validation()->set_rules('timezone', 'lang:timezone', 'required');
     \CI::form_validation()->set_rules('currency_iso', 'lang:currency', 'required');
     \CI::form_validation()->set_rules('ssl_support', 'lang:ssl_support');
     \CI::form_validation()->set_rules('stage', 'lang:stage');
     \CI::form_validation()->set_rules('stage_username', 'lang:stage_username');
     \CI::form_validation()->set_rules('stage_password', 'lang:stage_password');
     \CI::form_validation()->set_rules('require_login', 'lang:require_login');
     \CI::form_validation()->set_rules('new_customer_status', 'lang:new_customer_status');
     \CI::form_validation()->set_rules('weight_unit', 'lang:weight_unit');
     \CI::form_validation()->set_rules('order_status', 'lang:order_status');
     \CI::form_validation()->set_rules('inventory_enabled', 'lang:inventory_enabled');
     \CI::form_validation()->set_rules('allow_os_purchase', 'lang:allow_os_purchase');
     \CI::form_validation()->set_rules('tax_address', 'lang:tax_address');
     \CI::form_validation()->set_rules('tax_shipping', 'lang:tax_shipping');
     // get the values from the DB
     $data = array_merge($data, \CI::Settings()->get_settings('gocart'));
     $data['config'] = $data;
     //break out order statuses to an array
     //get installed themes
     $data['themes'] = [];
     $themePath = FCPATH . 'themes/';
     if ($handle = opendir($themePath)) {
         while (false !== ($entry = readdir($handle))) {
             if ($entry != "." && $entry != ".." && is_dir($themePath . $entry)) {
                 $data['themes'][$entry] = $entry;
             }
         }
         closedir($handle);
     }
     asort($data['themes']);
     //get locales
     $locales = \ResourceBundle::getLocales('');
     $data['locales'] = [];
     foreach ($locales as $locale) {
         $data['locales'][$locale] = locale_get_display_name($locale);
     }
     asort($data['locales']);
     //get ISO 4217 codes
     $data['iso_4217'] = [];
     $iso_4217 = json_decode(json_encode(simplexml_load_file(FCPATH . 'ISO_4217.xml')));
     $iso_4217 = $iso_4217->CcyTbl->CcyNtry;
     foreach ($iso_4217 as $iso_code) {
         if (isset($iso_code->Ccy)) {
             $data['iso_4217'][$iso_code->Ccy] = $iso_code->Ccy;
         }
     }
     asort($data['iso_4217']);
     $data['countries_menu'] = \CI::Locations()->get_countries_menu();
     if (!empty($data['country_id'])) {
         $data['zones_menu'] = \CI::Locations()->get_zones_menu($data['country_id']);
     } else {
         $countries_menu = array_keys($data['countries_menu']);
         $data['zones_menu'] = \CI::Locations()->get_zones_menu(array_shift($countries_menu));
     }
     $data['page_title'] = lang('common_gocart_configuration');
     $pages = \CI::Pages()->get_pages_tiered();
     $data['pages'] = [];
     foreach ($pages['all'] as $page) {
         if (empty($page->url)) {
             $data['pages'][$page->id] = $page->title;
         }
     }
     if (\CI::form_validation()->run() == FALSE) {
         $data['error'] = validation_errors();
         $this->view('settings', $data);
     } else {
         \CI::session()->set_flashdata('message', lang('config_updated_message'));
         $save = \CI::input()->post();
         //fix boolean values
         $save['ssl_support'] = (bool) \CI::input()->post('ssl_support');
         $save['require_login'] = (bool) \CI::input()->post('require_login');
//.........这里部分代码省略.........
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:101,代码来源:AdminSettings.php

示例6: delete

 function delete($id)
 {
     $page = \CI::Pages()->get_page($id);
     if ($page) {
         \CI::Pages()->delete_page($id);
         \CI::session()->set_flashdata('message', lang('message_deleted_page'));
     } else {
         \CI::session()->set_flashdata('error', lang('error_page_not_found'));
     }
     redirect('admin/pages');
 }
开发者ID:haouach,项目名称:GoCart3,代码行数:11,代码来源:AdminPages.php


注:本文中的CI::Pages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。