我对数组和案例切换器有疑问。
基本上,我正在开发一个主题选项页面,目前有一个选择机制......
# Select Box
case 'select':
$output .= '<select class="of-input" name="'. $value['id'] .'" id="'. $value['id'] .'">';
$select_value = get_option($value['id']);
asort($value['options']);
reset($value['options']);
foreach ($value['options'] as $option) {
$selected = '';
if($select_value != '') {
if ( $select_value == $option) {
$selected = ' selected="selected"';
}
}
$output .= '<option'. $selected .'>';
$output .= $option;
$output .= '</option>';
}
$output .= '</select>';
break;
然后,在主题选项中,我为我添加的NivoSlider创建了一个这样的数组,并且select选项正在运行..
# NivoSlider Effect Options
$hd_slider_effect_options = array(
"random"=> __('Random', 'hd'),
"sliceDownLeft" => __('Slice Down Left', 'hd'),
"sliceUp" => __('Slice Up', 'hd'),
"sliceUpLeft" => __('Slice Up Left', 'hd'),
"sliceUpDown" => __('Slice Up Down', 'hd'),
"sliceUpDownLeft" => __('Slice Up Down Left', 'hd'),
"fold" => __('Fold', 'hd'),
"fade" => __('Fade', 'hd'),
"slideInRight" => __('Slide In Right', 'hd'),
"slideInLeft" => __('Slide In Left', 'hd'),
"sliceDown" => __('Slice Down', 'hd')
);
但是,现在我正在配置主题选项以使用滑块,我遇到了问题。当我查看我的源代码时,它为淡入淡出选项添加了大写字母F而不是A侧输出,而是输出B侧而不是...为什么?
这是我的slider.php中的一些代码,以使它更清晰..
<?php
$hd_slider_effect = get_option('theme_slider_effect');
$hd_slider_slices = get_option('theme_slider_slices');
$hd_slider_speed = get_option('theme_slider_speed');
$hd_slider_pause_time = get_option('theme_slider_pause_time');
$hd_slider_pause = get_option('theme_slider_pause');
$hd_slider_play = get_option('theme_slider_play');
?>
<script type="text/javascript">
jQuery.noConflict()(function($){
$(document).ready(function() {
$('#hd-slider').nivoSlider({
manualAdvance: <?php echo $hd_slider_play; ?>,
effect: '<?php echo $hd_slider_effect; ?>',
slices: <?php echo $hd_slider_slices; ?>,
animSpeed: <?php echo $hd_slider_speed; ?>,
//pauseTime: 5000,
startSlide: 0,
controlNav: true,
keyboardNav: true,
pauseOnHover: true,
captionOpacity: 0.6,
directionNav: true,
directionNavHide: true
});
});
});
</script>
这就是它在源代码中的表现:
<script type="text/javascript">
jQuery.noConflict()(function($){
$(document).ready(function() {
$('#hd-slider').nivoSlider({
manualAdvance: True, // this needs to be lowercase t
effect: 'Fade', // this needs to be lowercase f
slices: 10,
animSpeed: 1000,
//pauseTime: 5000,
startSlide: 0,
controlNav: true,
keyboardNav: true,
pauseOnHover: true,
captionOpacity: 0.6,
directionNav: true,
directionNavHide: true
});
});
});
</script>
那么,有谁知道如何解决这个问题?非常感谢您的帮助。
答案 0 :(得分:0)
strtolower()
PHP函数应该为你解决这个问题。