【发布时间】:2016-09-14 18:18:48
【问题描述】:
我们正在尝试使用 jQuery 步骤将表单分解为多个页面。错误指向我们正在尝试创建的表单。对表单的调用最初如下所示:
$enable_paid_submission = houzez_option('enable_paid_submission');
$user_pack_id = get_the_author_meta( 'package_id' , $userID );
$remaining_listings = 0;
if( is_page_template( 'submit_property_test.php' ) ) {
if( $enable_paid_submission == 'membership' && $remaining_listings != -1 && $remaining_listings < 1 ) {
print '<div class="user_package_status"><h4>'.esc_html__('HTMLhere.','houzez' ).'</h4></div>';
<?php
$layout = houzez_option('property_form_sections');
$layout = $layout['enabled'];
if ($layout): foreach ($layout as $key=>$value) {
switch($key) {
case 'features':
get_template_part( 'features' );
break;
case 'location':
get_template_part( 'location' );
break;
case 'multi-units':
get_template_part('multi-units');
break;
}
}
endif;
?>
我们想将表单的三个部分(特征、位置和多单元)分成三个不同的页面。我们添加了 jQuery 步骤,现在看起来如下所示:
<script>
$(function ()
{
$("#wizard").steps({
headerTag: "h2",
bodyTag: "section",
transitionEffect: "fade"
});
});
</script>
<div id="wizard">
<h2>Features</h2>
<section>
<?php
$layout = houzez_option('property_form_sections');
$layout = $layout['enabled'];
if ($layout): foreach ($layout as $key=>$value) {
switch($key) {
case 'description-price':
get_template_part('features');
break;
}
}
endif;
?>
<h2>Location</h2>
<section>
<?php
$layout = houzez_option('property_form_sections');
$layout = $layout['enabled'];
if ($layout): foreach ($layout as $key=>$value) {
switch($key) {
case 'description-price':
get_template_part('location');
break;
}
}
endif;
?>
</section>
<h2>Multi-units</h2>
<section>
<?php
$layout = houzez_option('property_form_sections');
$layout = $layout['enabled'];
if ($layout): foreach ($layout as $key=>$value) {
switch($key) {
case 'description-price':
get_template_part('multi-units');
break;
}
}
endif;
?>
</section>
在最初的几个小时内运行良好。现在它正在返回错误。
【问题讨论】:
-
这是 JavaScript 错误还是 PHP 错误?如果出现 PHP 错误(由于字符串
'enabled'的位置,我预计会出现这种错误),请相应地更新您的标签。 -
这实际上是 Wordpress 网站中的 PHP 错误。添加 PHP 作为标签之一。谢谢你的收获。
标签: php jquery string offset jquery-steps