首页 新闻 会员 周边 捐助

unexpected 'endforeach'

0
悬赏园豆:10 [已关闭问题] 关闭于 2015-09-09 07:16
 1 {if $vote}
 2 {insert_scripts files='transport.js'}
 3 
 4 <div id="ECS_VOTE">
 5 <div  class="box">
 6  <div class="box_1">
 7   <h3><span><?php echo $this->_var['lang']['online_vote']; ?></span></h3>
 8   <div  class="boxCenterList">
 9     <form id="formvote" name="ECS_VOTEFORM" method="post" action="javascript:submit_vote()">
10     {foreach from=$vote item=title}
11      <?php echo $this->_var['title']['vote_name']; ?><br />
12      (<?php echo $this->_var['lang']['vote_times']; ?>:<?php echo $this->_var['title']['vote_count']; ?>)<br />
13      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
14      {foreach from=$vote item=title}
15           {foreach from=$title.options item=item}
16             {if $title.can_multi eq 0}
17             <input type="checkbox" name="option_id" value="<?php echo $this->_var['item']['option_id']; ?>" />
18             <?php echo $this->_var['item']['option_name']; ?> (<?php echo $this->_var['item']['percent']; ?>%)<br />
19             {else}
20             <input type="radio" name="option_id" value="<?php echo $this->_var['item']['option_id']; ?>" />
21             <?php echo $this->_var['item']['option_name']; ?> (<?php echo $this->_var['item']['percent']; ?>%)<br />
22             <?php endif; ?>
23             <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
24             <input type="hidden" name="type" value="<?php echo $this->_var['title']['can_multi']; ?>" />
25      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
26      <input type="hidden" name="id" value="<?php echo $this->_var['vote_id']; ?>" />
27      <input type="submit" name="submit" style="border:none;" value="<?php echo $this->_var['lang']['submit']; ?>"  class="bnt_bonus" />
28      <input type="reset" style="border:none;" value="<?php echo $this->_var['lang']['reset']; ?>" class="bnt_blue" />
29      </form>
30   </div>
31  </div>
32 </div>
33 </div>
34 <div class="blank5"></div>
35 <script type="text/javascript">
36 {literal}
37 /**
38  * 处理用户的投票
39  */
40 function submit_vote()
41 {
42   var frm     = document.forms['ECS_VOTEFORM'];
43   var type    = frm.elements['type'].value;
44   var vote_id = frm.elements['id'].value;
45   var option_id = 0;
46 
47   if (frm.elements['option_id'].checked)
48   {
49     option_id = frm.elements['option_id'].value;
50   }
51   else
52   {
53     for (i=0; i<frm.elements['option_id'].length; i++ )
54     {
55       if (frm.elements['option_id'][i].checked)
56       {
57         option_id = (type == 0) ? option_id + "," + frm.elements['option_id'][i].value : frm.elements['option_id'][i].value;
58       }
59     }
60   }
61 
62   if (option_id == 0)
63   {
64     return;
65   }
66   else
67   {
68     Ajax.call('vote.php', 'vote=' + vote_id + '&options=' + option_id + "&type=" + type, voteResponse, 'POST', 'JSON');
69   }
70 }
71 
72 /**
73  * 处理投票的反馈信息
74  */
75 function voteResponse(result)
76 {
77   if (result.message.length > 0)
78   {
79     alert(result.message);
80   }
81   if (result.error == 0)
82   {
83     var layer = document.getElementById('ECS_VOTE');
84 
85     if (layer)
86     {
87       layer.innerHTML = result.content;
88     }
89   }
90 }
91 
92 </script>
93 <?php endif; ?>
PHP Parse error:  syntax error, unexpected 'endforeach' (T_ENDFOREACH) in E:\ecshop\temp\compiled\vote.lbi.php on line 13
我是不懂PHP
这个是ecshop的一段代码
php
生活还是要继续的主页 生活还是要继续 | 初学一级 | 园豆:10
提问于:2014-10-05 21:37
< >
分享
所有回答(1)
0

你第13行的endforeach没有匹配的foreach开头,上面第10行那个没有声明为PHP代码段。

要么两个都有<?php 作为开头,要么两个都不带<?php这才对吧。

爱编程的大叔 | 园豆:30844 (高人七级) | 2014-10-06 09:45

你好,能不能详细一点,我对这个是没有基础

支持(0) 反对(0) 生活还是要继续 | 园豆:10 (初学一级) | 2014-10-07 22:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册