2017-05-30 179 views
-1

已解決:short_open_tag已關閉,這就是問題所在。打開它,現在一切正常!解析錯誤:語法錯誤,意外'endif'(T_ENDIF)

我目前正在製作一個主題,發生這種情況。我不明白爲什麼代碼不起作用。我已閱讀一些類似的話題,但他們不幫助解決我的問題:

解析錯誤:語法錯誤,意外的'endif'(T_ENDIF)在C:\ xampp \ htdocs \ wp \ wp-content \ themes \ boxtruyen \ single-ngan.php on line

請幫忙,我找不出錯誤!

<?php get_header(); ?> 
    <?php if(have_posts()):?> 
    <?php while (have_posts()):?> 
    <?php the_post(); tw_views($ID_parent); ?> 
    <input id="id_post" type="hidden" value="<?=$ID_parent?>"> 
    <div class="container" id="truyen"> 
     <div class="col-xs-12 col-sm-12 col-md-9 col-truyen-main"> 
      <div class="row"> 
       <div class="col-xs-12 col-info-desc" itemscope itemtype="http://schema.org/Book"> 
        <div class="title-list"> 
         <h2><span class="glyphicon glyphicon-info-sign"></span> <?the_title()?></h2> 
        </div> 
        <div class="col-xs-12"> 
         <style> 
          .fix_color { 
           color: #C1377F; 
          } 
          .fix_color a { 
           color: #C1377F; 
          } 
         </style> 
         Đăng bởi <span class="fix_color"><?the_author()?></span>, lúc <span class="fix_color"><?the_time()?></span>, tại <span class="fix_color"><?the_category(', ')?></span> 
         <br/> Đọc: 
         <?php tw_views(get_the_ID());?> 
         <?php echo tw_get_views(get_the_ID())?> 
         <br/> 
         <br/> 
         <img class="image_ngan" src="<?=tw_get_thumbnail()?>" alt="<?the_title()?>" itemprop="image" /> 
         <?php the_content()?> 
        </div> 
       </div> 
      </div> 
      <div class="row text-center"> 
       <div class="hidden-xs hidden-sm hidden-md"> 
        <div class="ads-780-90"> 
         <?php dynamic_sidebar('qc-780x90');?> 
        </div> 
       </div> 
       <div class="hidden-lg"> 
        <div class="ads-320-100"> 
         <?php dynamic_sidebar('qc-320x100');?> 
        </div> 
       </div> 
      </div> 
      <div class="row visible-md visible-lg"> 
       <div class="col-xs-12 comment-box"> 
        <div class="title-list"> 
         <h2><span class="glyphicon glyphicon-comment"></span> Bình luận</h2> 
        </div> 
        <div class="row"> 
         <div class="fb-comments" data-href="<?the_permalink()?>" data-width="100%" data-numposts="5" data-colorscheme="light"></div> 
        </div> 
       </div> 
       <div class="col-xs-12 comment-box"> 
        <div class="title-list"> 
         <h2><span class="glyphicon glyphicon-list"></span> Cùng Chuyên Mục</h2> 
        </div> 
        <div class="row cungchuyenmuc"> 
         <style> 
          .cungchuyenmuc li { 
           list-style: none; 
           width: 20%; 
           padding: 15px; 
          } 
         </style> 
         <?php $args=array('post_type'=> array('ngan'), 'post_status' => 'publish', 'posts_per_page' => $related_number, 'post__not_in' => array($ID_parent), 'orderby' => 'RAND'); $list = new wp_query($args); ?> 
         <?php while($list->have_posts()):?> 
         <?php $list->the_post()?> 
         <li class="col-md-4 col-sm-6 col-xs-12"> 
          <a href="<?the_permalink()?>"> 
           <img style="max-width:100%;width:100%;max-height: 160px" src="<?=tw_get_thumbnail()?>" alt="<?the_title()?>"/><br/> 
           <h3 style="margin:8px 0px;text-shadow:0px 0px 1px #bbb"><?the_title()?></h3> 
          </a> 
         </li> 
         <?endwhile;?> 
        </div> 
       </div> 
      </div> 
     </div> 
     <div class="hidden-xs hidden-sm col-md-3 text-center col-truyen-side"> 
      <div class="ads-300-250"></div> 
      <div class="list list-truyen col-xs-12"> 
       <div class="title-list"> 
        <h4><span class="glyphicon glyphicon-list"></span> Truyện đang hot</h4> 
       </div> 
       <?php $args=array('post_type'=> 'post', 'post_status' => 'publish', 'posts_per_page' => $so_truyen_dang_hot, 'post__not_in' => array($ID_parent), 'orderby' => 'meta_value_num', 'meta_key' => 'tw_views_post', 'ignore_sticky_posts' => -1, 'order' => 'DESC'); $list = new wp_query($args); ?> 
       <?while($list->have_posts()):?> 
        <?$list->the_post();?> 
         <div class="row"> 
          <div class="col-xs-12"> 
           <span class="glyphicon glyphicon-chevron-right"></span> 
           <a href="<?the_permalink()?>" title="<?the_title()?>"> 
            <?the_title()?> 
           </a> 
          </div> 
         </div> 
         <?endwhile;?> 
      </div> 
      <div class="ads-300-600"> 
       <?php dynamic_sidebar('qc-300x600'); ?> 
      </div> 
     </div> 
    </div> 
    <?php endwhile; ?> 
    <?php endif; ?> 
    </div> 
    <?php get_footer(); ?> 
+0

您是否啓用了短標記?嘗試所有實例的「<?php」。 – ASR

+0

你說得對,問題是短標籤未啓用!感謝您的幫助。 –

回答

-1

不要使用PHP的短標籤,如<?endwhile;?>改用<?php endwhile; ?>。將所有短標籤替換爲<?php ?>

相關問題