本文整理汇总了PHP中Model_Config::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Config::Get方法的具体用法?PHP Model_Config::Get怎么用?PHP Model_Config::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Config
的用法示例。
在下文中一共展示了Model_Config::Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Set
/**
* A shortcut for creating or updating a config value.
* @param string $name The config name.
* @param string $value The config value.
* @return Dbi_Record The resulting record.
*/
public static function Set($name, $value)
{
$config = Model_Config::Get($name);
if (!$config->exists()) {
$config = Model_Config::Create();
$config['configname'] = $name;
}
$config['configvalue'] = $value;
$config->save();
return $config;
}
示例2: foreach
* admin edit controller
*/
Plugin_Breadcrumbs::Add('Edit');
$config = Typeframe::Registry()->getConfig($_REQUEST['config']);
if (!$config) {
Typeframe::Redirect('Invalid config specified', Typeframe::CurrentPage()->applicationUri(), 1);
return;
}
if ($config->redirect()) {
Typeframe::Redirect('Redirecting to ' . $config->name() . ' admin...', $config->redirect());
return;
}
// update the config settings
if ('POST' == $_SERVER['REQUEST_METHOD']) {
foreach ($config->items() as $i) {
$config = Model_Config::Get($i->name());
if (!$config->exists()) {
$config = Model_Config::Create();
$config['configname'] = $i->name();
}
$config['configvalue'] = isset($_POST[$i->name()]) ? $_POST[$i->name()] : '';
$config->save();
}
Typeframe::Registry()->purgeRegistryCache();
Typeframe::Redirect('Configuration updated.', Typeframe::CurrentPage()->applicationUri());
return;
}
// otherwise, set it up to edit
//if ($config->template()) Typeframe::SetPageTemplate($config->template());
$object = new stdClass();
$object->name = $config->name();
示例3: array
<?php
$db = Typeframe::Database();
$pm = Typeframe::Pagemill();
Typeframe::SetPageTemplate('/admin/skins/index.html');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$skins = array('TYPEF_SITE_SKIN', 'TYPEF_ADMIN_SKIN', 'TYPEF_MOBILE_SITE_SKIN', 'TYPEF_MOBILE_ADMIN_SKIN');
$key = $_POST['config'];
if (in_array($key, $skins)) {
$config = Model_Config::Get($key);
if ($config->exists()) {
$config['configvalue'] = $_POST['skin'];
} else {
$config = Model_Config::Create();
$config['configname'] = $key;
$config['configvalue'] = $_POST['skin'];
}
$config->save();
Typeframe::Registry()->purgeRegistryCache();
}
Typeframe::Redirect('Skins updated.', Typeframe::CurrentPage()->applicationUri());
return;
}
foreach (Typeframe::GetSkins() as $skin) {
$row = array();
$row['skin'] = $skin;
if (file_exists(TYPEF_DIR . "/skins/{$skin}/config.xml")) {
$row['configurable'] = true;
} else {
$row['configurable'] = false;
}