本文整理汇总了PHP中core\Config::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::set方法的具体用法?PHP Config::set怎么用?PHP Config::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Config
的用法示例。
在下文中一共展示了Config::set方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: config
function config($name, $value = null)
{
if (!$value) {
return Config::get($name);
}
Config::set($name, $value);
}
示例2: innerAction
public function innerAction()
{
$this->_template = 'CatalogItemsWithoutFilter';
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Check for existance
$brand = DB::select()->from('brands')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->as_object()->execute()->current();
if (!$brand) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $brand->h1;
$this->_seo['title'] = $brand->title;
$this->_seo['keywords'] = $brand->keywords;
$this->_seo['description'] = $brand->description;
$this->setBreadcrumbs($brand->name);
// Get count items per page
$limit = (int) Arr::get($_GET, 'per_page') ? (int) Arr::get($_GET, 'per_page') : Config::get('limit');
// Get sort type
$sort = in_array(Arr::get($_GET, 'sort'), array('name', 'created_at', 'cost')) ? Arr::get($_GET, 'sort') : 'sort';
$type = in_array(strtolower(Arr::get($_GET, 'type')), array('asc', 'desc')) ? strtoupper(Arr::get($_GET, 'type')) : 'ASC';
// Get popular items
$result = DB::select(array('catalog_images.image', 'image'), 'catalog.*')->from('catalog')->join('catalog_images', 'LEFT')->on('catalog_images.catalog_id', '=', 'catalog.id')->on('catalog_images.main', '=', DB::expr('1'))->where('catalog.brand_id', '=', $brand->id)->where('catalog.status', '=', 1)->order_by('catalog.' . $sort, $type)->limit($limit)->offset(($page - 1) * $limit)->as_object()->execute();
// Set description of the brand to show it above the sort part
Config::set('brand_description', View::tpl(array('brand' => $brand), 'Brands/Inner'));
// Count of parent groups
$count = DB::select(array(DB::expr('COUNT(catalog.id)'), 'count'))->from('catalog')->where('brand_id', '=', $brand->id)->where('status', '=', 1)->as_object()->execute()->current()->count;
// Generate pagination
$pager = Pager::factory($page, $count, $limit)->create();
// Render template
$this->_content = View::tpl(array('result' => $result, 'pager' => $pager), 'Catalog/ItemsList');
}
示例3: config
private function config()
{
$result = DB::select('key', 'zna')->from('config')->where('status', '=', 1)->find_all();
foreach ($result as $obj) {
Config::set($obj->key, $obj->zna);
}
$this->setBreadcrumbs('Главная', 'backend');
}
示例4: config
private function config()
{
Config::set('content_class', 'wTxt');
$result = DB::select('key', 'zna')->from('config')->where('status', '=', 1)->as_object()->execute();
foreach ($result as $obj) {
Config::set($obj->key, $obj->zna);
}
$result = DB::select('script', 'place')->from('seo_metrika')->where('status', '=', 1)->as_object()->execute();
foreach ($result as $obj) {
$this->_seo['metrika'][$obj->place][] = $obj->script;
}
$result = DB::select('script')->from('seo_counters')->where('status', '=', 1)->as_object()->execute();
foreach ($result as $obj) {
$this->_seo['counters'][] = $obj->script;
}
$this->setBreadcrumbs('Главная', '');
}
示例5: innerAction
public function innerAction()
{
Config::set('content_class', 'new_block');
// Check for existance
$obj = DB::select()->from('articles')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->find();
if (!$obj) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $obj->h1;
$this->_seo['title'] = $obj->title;
$this->_seo['keywords'] = $obj->keywords;
$this->_seo['description'] = $obj->description;
$this->setBreadcrumbs($obj->name);
// Add plus one to views
DB::update('articles')->set(array('views' => $obj->views + 1))->where('id', '=', $obj->id)->execute();
// Render template
$this->_content = View::tpl(array('obj' => $obj), 'Articles/Inner');
}
示例6: addMeta
public function addMeta($name, $order = false)
{
Config::set('h1', $name);
Config::set('title', $name);
Config::set('keywords', $name);
Config::set('description', $name);
if ($order) {
$this->setBreadcrumbs('Личный кабинет', 'user/orders');
}
$this->setBreadcrumbs($name);
}
示例7: before
function before()
{
parent::before();
$this->_toolbar = Widgets::get('Toolbar/Edit');
Config::set('colls', 'column-2');
}
示例8: array
define('DEFAULT_CONTROLLER', 'General');
define('DEFAULT_METHOD', 'inicio');
/**
* Set the default template.
*/
define('TEMPLATE', 'Default');
/**
* Set a default language.
*/
define('LANGUAGE_CODE', 'en');
/**
* PREFER to be used in database calls default is smvc_
*/
define('PREFIX', '');
/**
* Set prefix for sessions.
*/
define('SESSION_PREFIX', '');
/**
* Optional create a constant for the name of the site.
*/
define('SITETITLE', 'Dcorrido');
/**
* Optional set a site email address.
*/
define('SITEEMAIL', 'alejandrozv@icloud.com');
/**
* Setup the (class) Aliases configuration.
*/
Config::set('class_aliases', array('Errors' => '\\Core\\Error', 'Language' => '\\Core\\Language', 'Mail' => '\\Helpers\\PhpMailer\\Mail', 'Assets' => '\\Helpers\\Assets', 'Arr' => '\\Helpers\\Arr', 'Cookie' => '\\Helpers\\Cookie', 'Csrf' => '\\Helpers\\Csrf', 'Date' => '\\Helpers\\Date', 'Document' => '\\Helpers\\Document', 'Form' => '\\Helpers\\Form', 'Ftp' => '\\Helpers\\Ftp', 'GeoCode' => '\\Helpers\\GeoCode', 'Hooks' => '\\Helpers\\Hooks', 'Inflector' => '\\Helpers\\Inflector', 'Number' => '\\Helpers\\Number', 'Paginator' => '\\Helpers\\Paginator', 'Password' => '\\Helpers\\Password', 'RainCaptcha' => '\\Helpers\\RainCaptcha', 'Request' => '\\Helpers\\Request', 'ReservedWords' => '\\Helpers\\ReservedWords', 'Response' => '\\Helpers\\Response', 'Session' => '\\Helpers\\Session', 'SimpleCurl' => '\\Helpers\\SimpleCurl', 'TableBuilder' => '\\Helpers\\TableBuilder', 'Tags' => '\\Helpers\\Tags', 'Url' => '\\Helpers\\Url'));
示例9: setFilterParameters
public static function setFilterParameters()
{
if (!Route::param('filter')) {
return false;
}
$fil = Route::param('filter');
$fil = explode("&", $fil);
$filter = array();
foreach ($fil as $g) {
$g = urldecode($g);
$g = strip_tags($g);
$g = stripslashes($g);
$g = trim($g);
$s = explode("=", $g);
$filter[$s[0]] = explode(",", $s[1]);
}
conf::set('filter_array', $filter);
return true;
}
示例10: addAction
function addAction()
{
if ($_POST) {
$error = 0;
$post = $_POST['FORM'];
$post['status'] = Arr::get($_POST, 'status', 0);
if (!trim(Arr::get($post, 'name'))) {
Message::GetMessage(0, 'Наименование страницы не может быть пустым!');
$error = 1;
}
if (!trim(Arr::get($post, 'alias'))) {
Message::GetMessage(0, 'Алиас не может быть пустым!');
$error = 1;
}
if (!$error) {
$post['alias'] = Common::getUniqueAlias($this->tablename, Arr::get($post, 'alias'));
$res = Common::insert($this->tablename, $post)->execute();
if ($res) {
Message::GetMessage(1, 'Вы успешно добавили данные!');
HTTP::redirect('backend/' . Route::controller() . '/' . Route::action());
} else {
Message::GetMessage(0, 'Не удалось добавить данные!');
}
}
$result = Arr::to_object($post);
} else {
$result = array();
}
$this->_toolbar = Widgets::get('Toolbar/Edit');
Config::set('colls', 'column-2');
$this->_seo['h1'] = 'Добавление';
$this->_seo['title'] = 'Добавление';
$this->setBreadcrumbs('Добавление', 'backend/' . Route::controller() . '/' . Route::action());
$this->_content = View::tpl(array('obj' => $result, 'tpl_folder' => $this->tpl_folder, 'tablename' => $this->tablename, 'tree' => Support::getSelectOptions('Content/Select', 'content', $result->parent_id)), $this->tpl_folder . '/Form');
}
示例11: Bootstrap
<?php
require_once __DIR__ . '/autoload.php';
use core\Config;
use core\Bootstrap;
Config::set(['app' => ['name' => 'PHPancy', 'version' => '0.0.1'], 'mysql' => ['host' => '127.0.0.1', 'db' => 'phpancy', 'user' => 'root', 'pass' => 'password'], 'session' => ['name' => 'user', 'token' => 'xsrf'], 'cookie' => ['name' => 'remember', 'expiry' => 604800]]);
try {
(new Bootstrap())->init();
} catch (Exception $e) {
echo $e->getMessage();
}