本文整理汇总了PHP中gcms::ser2Array方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::ser2Array方法的具体用法?PHP gcms::ser2Array怎么用?PHP gcms::ser2Array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::ser2Array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$content[] = '<label for=category_can_reply>{LNG_CAN_REPLY}</label>';
$content[] = '<span class="g-input icon-comments"><select name=category_can_reply id=category_can_reply title="{LNG_CANREPLY_SETTING}">';
foreach ($lng['LNG_CAN_REPLIES'] as $i => $item) {
$sel = $index['can_reply'] == $i ? ' selected' : '';
$content[] = '<option value=' . $i . $sel . '>' . $item . '</option>';
}
$content[] = '</select></span>';
$content[] = '</div>';
$content[] = '</div>';
$content[] = '<div class=comment>{LNG_CATEGORY_CAN_PUBLISHED_REPLY_COMMENT}</div>';
$content[] = '</div>';
$content[] = '</fieldset>';
// topic,detail,icon
$topic = gcms::ser2Array($index, 'topic');
$detail = gcms::ser2Array($index, 'detail');
$icon = gcms::ser2Array($index, 'icon');
$multi_language = sizeof($config['languages']) > 1;
foreach ($config['languages'] as $item) {
$content[] = '<fieldset>';
$content[] = '<legend><span>{LNG_CATEGORY_DETAIL} <img src="' . ($item == '' ? "../skin/img/blank.gif" : DATA_URL . 'language/' . $item . '.gif') . '" alt="' . $item . '"></span></legend>';
// topic
$content[] = '<div class=item>';
$content[] = '<label for=category_topic_' . $item . '>{LNG_CATEGORY}</label>';
$t = isset($topic[$item]) ? $topic[$item] : (isset($topic['']) && (!$multi_language || $item == LANGUAGE && !isset($topic[LANGUAGE])) ? $topic[''] : '');
$content[] = '<span class="g-input icon-edit"><input type=text id=category_topic_' . $item . ' name=category_topic[' . $item . '] maxlength=64 title="{LNG_CATEGORY_COMMENT}" value="' . $t . '"></span>';
$content[] = '<div class=comment id=result_category_topic_' . $item . '>{LNG_CATEGORY_COMMENT}</div>';
$content[] = '</div>';
// detail
$content[] = '<div class=item>';
$content[] = '<div>';
$content[] = '<label for=category_detail_' . $item . '>{LNG_DESCRIPTION}</label>';
示例2: array
$content[] = '<th id=c9 scope=col></th>';
$content[] = '</tr>';
$content[] = '</thead>';
$content[] = '<tbody>';
// เรียกหมวดหมู่ทั้งหมด
$categories = array();
$sql = "SELECT * FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' ORDER BY `category_id`";
foreach ($db->customQuery($sql) as $item) {
$save = array();
gcms::r2config($item['config'], $save);
$save['category_id'] = $item['category_id'];
$save['published'] = $item['published'];
$save['c1'] = $item['c1'];
$topics = gcms::ser2Array($item, 'topic');
$details = gcms::ser2Array($item, 'detail');
$icons = gcms::ser2Array($item, 'icon');
foreach ($topics as $k => $v) {
$save['topic'] = empty($topics[$k]) ? isset($topics[LANGUAGE]) ? $topics[LANGUAGE] : '' : $topics[$k];
$save['detail'] = empty($details[$k]) ? isset($details[LANGUAGE]) ? $details[LANGUAGE] : '' : $details[$k];
$save['icon'] = empty($icons[$k]) ? isset($icons[LANGUAGE]) ? $icons[LANGUAGE] : '' : $icons[$k];
$categories[$item['id']][$k] = $save;
}
if (sizeof($categories[$item['id']]) == 1) {
foreach ($categories[$item['id']] as $k => $v) {
if ($k != '') {
$categories[$item['id']][''] = $v;
unset($categories[$item['id']][$k]);
}
}
}
}
示例3: array
$index = $db->getRec(DB_MODULES, $module);
if ($index) {
if (in_array($index['owner'], array('document', 'board'))) {
// config
gcms::r2config($index['config'], $index);
$admin = gcms::canConfig($index, 'can_config');
} else {
$admin = gcms::canConfig($config, $index['owner'] . '_can_config');
}
if ($admin && $action == 'delete') {
// ลบหมวดหมู่, ตรวจสอบรายการที่เลือก และลบ icon ของหมวด
$ids = array();
$categories = array();
$sql = "SELECT `id`,`icon` FROM `" . DB_CATEGORY . "` WHERE `id` IN ({$id}) AND `module_id`='{$index['id']}'";
foreach ($db->customQuery($sql) as $item) {
foreach (gcms::ser2Array($item, 'icon') as $icon) {
if (is_file(DATA_PATH . "{$index['owner']}/{$icon}")) {
// ลบไอคอนของหมวด
unlink(DATA_PATH . "{$index['owner']}/{$icon}");
}
}
// รายการที่ลบ category_detail
$ids[] = $item['id'];
}
if (sizeof($ids) > 0) {
// ลบ category
$db->query("DELETE FROM `" . DB_CATEGORY . "` WHERE `id` IN (" . implode(',', $ids) . ")");
}
} elseif ($admin && $action == 'categoryid') {
// เปลี่ยน category_id ที่หน้า category
$sql = "SELECT `id` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' AND `category_id`='{$value}'";