-2
IM中有一個小問題,把if
語句中if
statments例如:如果如果
<?php
$steponeimage = get_post_meta($post->ID, 'step_one_image', true);
$steponecontent = get_post_meta($post->ID, 'step_one_content', true);
$steptwoimage = get_post_meta($post->ID, 'step_two_image', true);
$steptwocontent = get_post_meta($post->ID, 'step_two_content', true);
$stepthreeimage = get_post_meta($post->ID, 'step_three_image', true);
$stepthreecontent = get_post_meta($post->ID, 'step_3_content', true);
if ($steponecontent) {
?>
<div id="processPanel" class="panel">
<a href="#content1" label="1">Step 1</a>
<?php if ($steptwocontent) { ?>
<a href="#content2" label="2">Step Two</a>
<?php } else { ?><?php } ?>
<?php if ($stepthreecontent) { ?>
<a href="#content3" label="3">Step Three</a>
<?php } else { ?><?php } ?>
<div id="content1">
<p><?php $images1 = $helper->imageDisplay($steponeimage , $height , $width , true , $ar[0] , false, false,'' ,'' ,false);
echo "<div class='imageholder'> $images1 </div>"; ?></p>
<p><?php echo $steponecontent; ?></p>
</div>
<?php if ($steptwocontent); { ?>
<div id="content2">
<p><?php $images2 = $helper->imageDisplay($steptwoimage , $height , $width , true , $ar[0] , false, false,'' ,'' ,false);
echo "<div class='imageholder'> $images2 </div>"; ?></p>
<p><?php echo $steptwocontent; ?></p>
</div><?php } else { ?><?php } ?>
<?php if ($stepthreecontent); { ?>
<div id="content3">
<p><?php $images3 = $helper->imageDisplay($stepthreeimage , $height , $width , true , $ar[0] , false, false,'' ,'' ,false);
echo "<div class='imageholder'> $images3 </div>"; ?></p>
<p><?php echo $stepthreecontent; ?></p>
</div><?php } else { ?><?php } ?>
</div>
<?php } else { ?>
<?php } ?>
我試着從一個WordPress後讀取後的元數據,如果有一步填補了這一個元包顯示了一步一步的信息。然後,如果兩個步驟的meta框填充在其加入的第二步那裏,如果第三步的盒子裏裝滿它,它添加的步驟三等
我的錯誤是
Parse error: syntax error, unexpected T_ELSE
這是從這裏來的:
<p><?php echo $steptwocontent; ?></p>
</div><?php } else { ?><?php } ?>
語法錯誤:過於本地化左右。你也應該有意識地縮進你的代碼,然後這些問題變得更容易避免。 – mario