本文整理汇总了PHP中segment函数的典型用法代码示例。如果您正苦于以下问题:PHP segment函数的具体用法?PHP segment怎么用?PHP segment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了segment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: results
public function results()
{
if (!$this->isAdmin) {
$this->login();
}
$this->check();
$this->title("Manage " . $this->application);
$this->CSS("results", "cpanel");
$this->CSS("pagination");
$this->js("checkbox");
$trash = segment(3, isLang()) === "trash" ? TRUE : FALSE;
$total = $this->CPanel_Model->total($trash);
$thead = $this->CPanel_Model->thead("checkbox, " . getFields($this->application) . ", Action", FALSE);
$pagination = $this->CPanel_Model->getPagination($trash);
$tFoot = getTFoot($trash);
$this->vars["message"] = !$tFoot ? "Error" : NULL;
$this->vars["pagination"] = $pagination;
$this->vars["trash"] = $trash;
$this->vars["search"] = getSearch();
$this->vars["table"] = getTable(__(_("Manage " . ucfirst($this->application))), $thead, $tFoot, $total);
$this->vars["view"] = $this->view("results", TRUE, "cpanel");
$this->render("content", $this->vars);
}
示例2: getPageTitle
/**
*
* function getPageTitle
*
*
*/
function getPageTitle()
{
$CI =& get_instance();
$page_index = $CI->uri - segment(1) . '/' . $CI->uri - segment(2);
$title = array('catalog/index' => 'Catalog', 'settings/edit_store' => 'Settings', 'pricingoverview/' => 'Reports', 'reports/' => 'Reports', 'reports/show' => 'Reports', '' => '');
return isset($title[$page_index]) ? 'TrackStreet :: ' . $title[$page_index] : 'TrackStreet';
}
示例3: limit
private function limit()
{
if (isLang()) {
if (segment(1) === "videos" and segment(2) > 0) {
$start = segment(2) * _maxLimitVideos - _maxLimitVideos;
} else {
$start = 0;
}
} else {
if (segment(0) === "videos" and segment(1) > 0) {
$start = segment(2) * _maxLimitVideos - _maxLimitVideos;
} else {
$start = 0;
}
}
$limit = $start . ", " . _maxLimitVideos;
$count = $this->Videos_Model->count();
$URL = path("videos/");
if ($count > _maxLimitVideos) {
$this->pagination = paginate($count, _maxLimitVideos, $start, $URL);
} else {
$this->pagination = NULL;
}
return $limit;
}
示例4: edit
function edit()
{
$data['title'] = 'Cập nhật danh mục tin tức';
$data['save'] = true;
$data['apply'] = true;
$data['cancel'] = 'category';
$id = segment(3, 'int');
$data['rs'] = $this->category->get_cat_by_id($id);
$data['listmain'] = $this->category->get_all_category();
$data['list'] = $this->category->get_category_by_lang($id);
// Form validation
//foreach($this->language as $lang):
$this->form_validation->set_rules('vdata[cat_name][' . $lang[0]->lang_id . ']', 'Danh mục ' . $lang[0]->lang_name, 'required');
$this->form_validation->set_rules('vdata[cat_des][' . $lang[0]->lang_id . ']', '', '');
$this->form_validation->set_rules('vdata[cat_keyword][' . $lang[0]->lang_id . ']', '', '');
//endforeach;
$this->form_validation->set_rules('vdata[cat_order]', '', '');
$this->form_validation->set_rules('vdata[parent_id]', '', '');
if ($this->form_validation->run() === FALSE) {
$this->pre_message = validation_errors();
} else {
$vdata = $this->request->post['vdata'];
$idata['cat_order'] = $vdata['cat_order'];
$idata['published'] = $vdata['published'];
$idata['parent_id'] = $vdata['parent_id'];
if ($this->db->update('category', $idata, array('cat_id' => $id))) {
$this->db->delete('category_des', array('cat_id' => $id));
for ($i = 0; $i < sizeof($this->language); $i++) {
$val1 = $this->language[0];
$val = $this->language[$i];
$vdes['cat_id'] = $id;
$vdes['lang_id'] = $val->lang_id;
$vdes['cat_name'] = $vdata['cat_name'][$val->lang_id] != '' ? $vdata['cat_name'][$val->lang_id] : $vdata['cat_name'][$val1->lang_id];
$vdes['cat_slug'] = vnit_change_title($vdes['cat_name']);
$vdes['cat_des'] = $vdata['cat_des'][$val->lang_id] != '' ? $vdata['cat_des'][$val->lang_id] : $vdata['cat_des'][$val1->lang_id];
$vdes['cat_keyword'] = $vdata['cat_keyword'][$val->lang_id] != '' ? $vdata['cat_keyword'][$val->lang_id] : $vdata['cat_keyword'][$val1->lang_id];
$this->db->insert('category_des', $vdes);
//Update news
$parent_id = $vdata['parent_id'];
$vnews['main_slug'] = $vdes['cat_slug'];
//$vnews['main_id'] = $vdes['cat_slug'];
$this->db->update('news_des', $vnews, array('cat_id' => $id, 'lang_id' => $val->lang_id));
}
$this->session->set_flashdata('message', 'Lưu thành công');
$option = $_POST['option'];
if ($option == 'save') {
$url = 'category';
} else {
$url = uri_string();
}
redirect($url);
}
}
$data['message'] = $this->pre_message;
$this->_templates['page'] = 'edit';
$this->load->templates($this->_templates['page'], $data);
}
示例5: del
function del()
{
$id = segment(3, 'int');
if ($this->db->delete('weblink', array('id' => $id))) {
$this->session->set_flashdata('message', 'Xóa thành công');
} else {
$this->session->set_flashdata('message', 'Xóa không thành công');
}
redirect('weblink/ds');
}
示例6: del
function del()
{
$id = segment(3, 'int');
$page = segment(4, 'int');
if ($this->db->delete('dangky', array('id' => $id))) {
$msg = "Xóa thành công";
} else {
$msg = "Xóa không thành công";
}
$this->session->set_flashdata('message', $msg);
redirect('dangky/ds/' . $page);
}
示例7: index
function index()
{
$data['title'] = lang('khachhang');
$config['base_url'] = base_url() . $this->lang_url . 'khach-hang';
$config['suffix'] = '.html';
$config['total_rows'] = $this->khachhang->get_num_khachhang($this->lang_id);
$data['num'] = $config['total_rows'];
$config['per_page'] = 15;
$config['uri_segment'] = 2;
$this->load->library('pagination');
$this->pagination->initialize($config);
$data['list'] = $this->khachhang->get_all_khachhang($config['per_page'], segment(2, 'int'), $this->lang_id);
$data['pagination'] = $this->pagination->create_links();
$this->load->templates('index', $data);
}
示例8: result
function result()
{
$s = $this->request->get['keyword'];
$key = str_replace('+', ' ', $s);
$data['key'] = $key;
$data['title'] = lang('s.timkiem') . ': ' . $key;
$config['base_url'] = base_url() . $this->lang_url . 'tim-kiem';
$config['suffix'] = '.html?keyword=' . $s;
$config['total_rows'] = $this->search->get_num_product($this->lang_id, $key);
$data['num'] = $config['total_rows'];
$config['per_page'] = 20;
$config['uri_segment'] = 2;
$this->load->library('pagination');
$this->pagination->initialize($config);
$data['list'] = $this->search->get_all_product($config['per_page'], segment(2, 'int'), $this->lang_id, $key);
$data['pagination'] = $this->pagination->create_links();
$this->load->templates('result', $data);
}
示例9: cat
function cat()
{
$slug = $this->uri->segment(2);
$catinfo = $this->news->get_catinfo_by_slug($this->lang_id, $slug);
$data['title'] = lang('tintuc') . ': ' . $catinfo->cat_name;
$data['catinfo'] = $catinfo;
$config['base_url'] = base_url() . $this->lang_url . 'tin-tuc/' . $slug;
$config['suffix'] = '.html';
$config['total_rows'] = $this->news->get_num_news($this->lang_id, $catinfo->cat_id);
$data['num'] = $config['total_rows'];
$config['per_page'] = 8;
$config['uri_segment'] = 3;
$this->load->library('pagination');
$this->pagination->initialize($config);
$data['list'] = $this->news->get_all_news($config['per_page'], segment(3, 'int'), $this->lang_id, $catinfo->cat_id);
$data['pagination'] = $this->pagination->create_links();
$this->load->templates('cat', $data);
}
示例10: ds
function ds()
{
$data['title'] = 'Quản lý Module';
$data['add'] = 'mod/readadd';
$data['delete'] = true;
$field = $this->request->get['f'] != '' ? $this->request->get['f'] : 'm-id';
$order = $this->request->get['o'] != '' ? $this->request->get['o'] : 'desc';
$config['suffix'] = '/' . $field . '/' . $order;
$config['base_url'] = base_url() . 'mod/ds/';
$config['total_rows'] = $this->mod->get_num_modules();
$data['num'] = $config['total_rows'];
$config['per_page'] = 20;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$data['list'] = $this->mod->get_all_modules($config['per_page'], segment(4, 'int'), str_replace('-', '.', $field), $order);
$data['pagination'] = $this->pagination->create_links();
$this->_templates['page'] = 'index';
$this->load->templates($this->_templates['page'], $data);
}
示例11: edit
function edit()
{
$data['title'] = 'Cập nhật danh mục Cơ Quan Tổ Chức';
$data['save'] = true;
$data['apply'] = true;
$data['cancel'] = 'category';
$id = segment(3, 'int');
$data['rs'] = $this->office->get_office_id($id);
$data['listmain'] = $this->office->get_all_office();
$data['list'] = $this->office->get_office_id($id);
// var_dump( $data['list'] );
// Form validation
//foreach($this->language as $lang):
$this->form_validation->set_rules('vdata[title]', 'Tên Cơ Quan Tổ Chức', 'required');
$this->form_validation->set_rules('vdata[website]', 'Website', '');
$this->form_validation->set_rules('vdata[address]', 'Địa chỉ', 'required');
$this->form_validation->set_rules('vdata[phone_1]', 'Số điện thoại', '');
//endforeach;
$this->form_validation->set_rules('vdata[ordering]', '', '');
$this->form_validation->set_rules('vdata[parent_id]', '', '');
if ($this->form_validation->run() === FALSE) {
$this->pre_message = validation_errors();
} else {
$vdata = $this->request->post['vdata'];
// var_dump($vdata);
// exit();
if ($this->db->update('office', $vdata, array('id' => $id))) {
//$this->db->delete('category_des', array('cat_id' => $id));, array('cat_id' => $id)
$this->session->set_flashdata('message', 'Lưu thành công');
$option = $_POST['option'];
if ($option == 'save') {
$url = 'office';
} else {
$url = uri_string();
}
redirect($url);
}
}
$data['message'] = $this->pre_message;
$this->_templates['page'] = 'edit';
$this->load->templates($this->_templates['page'], $data);
}
示例12: routePath
function routePath()
{
$flag = FALSE;
$rsaquo = " ›› ";
$path = path(whichApplication());
if (segments() > 0) {
for ($i = 0; $i <= segments() - 1; $i++) {
if (!$flag) {
if (segments() === 6) {
$flag = TRUE;
$HTML = a(__(_("Home")), PATH("cpanel")) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(2)))), $path . segment(2)) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(3)))), $path . segment(2) . _sh . segment(3)) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(4)))), $path . segment(2) . _sh . segment(3) . _sh . segment(4)) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(5)))), $path . segment(2) . _sh . segment(3) . _sh . segment(4) . _sh . segment(5));
} elseif (segments() === 5) {
$flag = TRUE;
$HTML = a(__(_("Home"), path("cpanel"))) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(2)))), $path . segment(2)) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(3)))), $path . segment(2) . _sh . segment(3)) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(4)))), $path . segment(2) . _sh . segment(3) . _sh . segment(4));
} elseif (segments() === 4) {
$flag = TRUE;
$HTML = a(__(_("Home")), path("cpanel")) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(1)))), $path . "cpanel") . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(3)))), $path . segment(2) . _sh . segment(3));
} elseif (segments() === 3) {
$flag = TRUE;
$HTML = a(__(_("Home")), path("cpanel")) . $rsaquo;
$HTML .= a(__(_(ucfirst(segment(1)))), $path . segment(3));
} elseif (segments() === 2) {
$flag = TRUE;
$HTML = a(__(_("Home")), path("cpanel"));
} else {
$HTML = a(__(_("Home")), path("cpanel"));
}
}
}
}
return $HTML;
}
示例13: index
public function index()
{
if (segment(2)) {
switch (segment(2)) {
case "gettoken":
$this->token();
break;
case "login":
$this->login();
break;
case "logout":
$this->logout();
break;
case "account":
$this->account();
break;
}
} else {
$this->login();
}
}
示例14: showImage
public function showImage()
{
$data = $this->Gallery_Model->getByID(segment(3), TRUE);
if (!$data) {
redirect(_webBase . _sh . getXMLang(whichLanguage()) . _sh . _gallery);
}
if ($data["Album"] !== "None") {
$this->count = $this->Gallery_Model->getCount($data["Album_Nice"]);
} else {
$this->count = $this->Gallery_Model->getCount();
}
//Código para comentarios:
/*
if(isset($_POST["publishComment"])) {
$this->Set("Comment");
}
if($this->Users_Model->isMember()) {
$vars["publish"] = TRUE;
}
if(isset($error) and is_array($error)) {
$vars["error"] = $error;
}
$comments = $this->Gallery_Model->getComments($this->record["ID"]);
if($comments == FALSE) $vars["comments"] = FALSE;
else $vars["comments"] = $comments;
*/
$vars["count"] = $this->count;
$vars["picture"] = $data;
if (_webGalleryComments === TRUE) {
$vars["view"][0] = $this->view("image", $this->application, TRUE);
$vars["view"][1] = $this->view("comments", $this->application, TRUE);
} else {
$vars["view"] = $this->view("image", $this->application, TRUE);
}
$this->template("content", $vars);
$this->Render();
}
示例15: getCategories
public function getCategories($action = "add", $type = "checkbox", $name = "categories")
{
if ($action === "add") {
$this->Categories_Model = $this->model("Categories_Model");
$data = $this->Categories_Model->categories();
if ($data) {
$HTML = $this->build($data, NULL, $type, $name);
} else {
return FALSE;
}
unset($this->HTML);
return $HTML;
} elseif ($action === "edit") {
$this->Categories_Model = $this->model("Categories_Model");
$categories = $this->Categories_Model->categories();
$data = $this->Categories_Model->getCategoriesByRecord("3", isLang() ? segment(4) : segment(3));
if ($data) {
$i = 0;
foreach ($categories as $category) {
foreach ($data as $category_match) {
if ($category["ID_Category"] === $category_match["ID_Category"]) {
$categories[$i]["checked"] = TRUE;
}
}
$i++;
}
}
$data = $categories;
if ($data) {
$HTML = $this->build($data, NULL, $type, $name);
} else {
return FALSE;
}
unset($this->HTML);
return $HTML;
}
}