本文整理汇总了PHP中Alias::val方法的典型用法代码示例。如果您正苦于以下问题:PHP Alias::val方法的具体用法?PHP Alias::val怎么用?PHP Alias::val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alias
的用法示例。
在下文中一共展示了Alias::val方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUrl
public function setUrl($url)
{
if ($url != $this->val('alias_url')) {
$a = new Alias($this->db);
$url = Alias::generateAliasUrl(myTrim($url));
$new_url = $url;
$a->loadByUrl($new_url);
$counter = 0;
while ($a->is_loaded && $a->val('alias_id') != $this->val('alias_id')) {
$counter += 1;
$new_url = $url . '-' . $counter;
$a->loadByUrl($new_url);
}
$this->data['alias_url'] = $new_url;
}
}
示例2: CustomerAuthentication
break;
// CUSTOMER SECTION
// CUSTOMER SECTION
default:
$theme = 'parfumerie';
$custAuth = new CustomerAuthentication($db);
$pg = $path[0];
if (strlen($pg) > 0) {
if (file_exists($home_dir . 'views/pages/' . $pg . '.v.php') || file_exists($home_dir . 'controllers/pages/' . $pg . '.c.php')) {
$page_template = 'pages/' . $pg;
} else {
require_once $home_dir . 'models/alias.m.php';
$alias = new Alias($db);
$alias->loadByUrl($raw_path);
if ($alias->is_loaded) {
$path = explode('/', $alias->val('alias_path'));
$page_template = 'pages/' . $path[0];
$raw_path = $alias->val('alias_path');
} else {
$page_template = 'pages/notfound';
}
}
} else {
$page_template = 'pages/front';
}
}
}
// run controller code if exists
$controller_path = $page_template . '.c.php';
if (file_exists($home_dir . 'controllers/' . $controller_path)) {
include $home_dir . 'controllers/' . $controller_path;
示例3: AdminForm
require_once $home_dir . 'models/category.m.php';
require_once $home_dir . 'models/alias.m.php';
require_once $home_dir . 'classes/forms.php';
$form = new AdminForm('category');
$page = 'admin/form';
$form->add([['name' => 'category_name', 'label' => 'Name', 'type' => 'text'], ['name' => 'alias_url', 'label' => 'Alias', 'type' => 'text'], ['name' => 'category_parent_id', 'label' => 'Parent Category', 'type' => 'select', 'select_table' => 'categories', 'select_id_field' => 'category_id', 'select_label_field' => 'category_name']]);
if (isset($_POST['category_id'])) {
$category = new Category($db, $_POST['category_id']);
$category->setData($form->processInput($_POST));
$category->data['category_parent_id'] = parseInt($category->val('category_parent_id'));
$alias_url = $category->val('alias_url');
unset($category->data['alias_url']);
$category->save();
$alias = new Alias($db, $category->ival('category_alias_id'));
// save alias if new or changed
if ($alias->val('alias_url') != $alias_url || !$alias->is_loaded) {
$alias->data['alias_path'] = $category->getAliasPath();
if (isset($alias_url) && strlen(trim($alias_url)) > 0) {
$alias->setUrl($alias_url);
} else {
$alias->setUrl($category->getAliasUrl());
}
$alias->save();
}
// update category alias if changed
if ($alias->ival('alias_id') != $category->ival('category_alias_id')) {
$category->data['category_alias_id'] = $alias->ival('alias_id');
$category->save();
}
$category->alias = $alias;
} elseif (isset($path[2]) && $path[2] == 'edit') {
示例4: getParentAlias
public function getParentAlias()
{
if ($this->ival('category_parent_id') > 0) {
$p = new Category($this->db, $this->ival('category_parent_id'));
$pa = new Alias($this->db, $p->ival('category_alias_id'));
if (!$pa->is_loaded) {
$pa->setUrl($p->getAliasUrl());
$pa->data['alias_path'] = $p->getAliasPath();
$pa->save();
$p->data['category_alias_id'] = $pa->val('alias_id');
$p->save();
}
return $pa;
}
}