本文整理汇总了PHP中settings::AddVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP settings::AddVariable方法的具体用法?PHP settings::AddVariable怎么用?PHP settings::AddVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings
的用法示例。
在下文中一共展示了settings::AddVariable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: settings
define('BANNER_PATH', 'banners/newsletter/');
define('MAX_SIZE', 5 * 1024 * 1024);
//5Mb
$action = __paramInit('string', 'action', 'action');
$type = __paramInit('bool', 'type', 'type');
$type_prefix = $type == 1 ? 'emp_' : '';
$settings = new settings();
switch ($action) {
case 'save':
$uploaded_file = new CFile($_FILES['file']);
$uploaded_file->server_root = 1;
$uploaded_file->max_size = MAX_SIZE;
$uploaded_file->allowed_ext = array('jpg', 'jpeg', 'gif', 'png');
$filename = $uploaded_file->MoveUploadedFile(BANNER_PATH);
if (!count($uploaded_file->error) && $filename) {
$settings->AddVariable('newsletter', $type_prefix . 'banner_file', WDCPREFIX . '/' . $uploaded_file->path . $uploaded_file->name);
$settings->AddVariable('newsletter', $type_prefix . 'banner_link', __paramInit('string', null, 'link'));
}
header_location_exit('./#' . ($type == 1 ? 'emp' : 'frl'));
break;
case 'delete':
$settings->SetVariable('newsletter', $type_prefix . 'banner_file', null);
$settings->SetVariable('newsletter', $type_prefix . 'banner_link', null);
break;
}
$newsletter_banner_file = $settings->GetVariable('newsletter', 'banner_file');
$newsletter_banner_link = $settings->GetVariable('newsletter', 'banner_link');
$newsletter_emp_banner_file = $settings->GetVariable('newsletter', 'emp_banner_file');
$newsletter_emp_banner_link = $settings->GetVariable('newsletter', 'emp_banner_link');
$content = '../content.php';
$inner_page = 'inner_index.php';