新做的模板,管理无法编辑帖子内容,求助

By 酷寒似暑 at 2015-10-22 • 0人收藏 • 318人看过

RT, 我用bootstrap3做前端模板,帖子内容页面,php相关的逻辑代码基本是从默认模板中复制来的,现在的问题是,可以正常编辑帖子的话题,但无法编辑内容编辑内容会出现

QQ截图20151022170526.png

编辑中,点编辑后  内容出现 空白,不会调出编辑器,如下

QQ截图20151022170604.png

难道是bootstrap与默认模板的JS有兼容问题,求助

topic.php代码如下

<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
?>
<script type="text/javascript">
  var TopicID = <?php echo $ID; ?>;
</script>
<div class="container">
  <!--路径导航开始-->
  <?php include($TemplatePath.'nav-min.php'); ?>
  <!--路径导航结束-->
  <div class="row clearfix">
    <!--内容主体开始-->
    <div class="col-xs-12 col-sm-6 col-md-8">

      <section class="art-box">
<?php if($Page==1){
      ?>
        <!-- post main content start -->
        <header>
          <h1><?php  echo $Topic['Topic']; ?></h1>
          <div class="art-user-time">By <a href="<?php echo $Config['WebsitePath'].'/u/'.urlencode($Topic['UserName']); ?>"><?php echo $Topic['UserName']; ?></a>
 at <?php echo FormatTime($Topic['PostTime']); ?> • <?php echo $Topic['Favorites']; ?><?php echo $Lang['People_Collection']; ?> • <?php echo ($Topic['Views']+1); ?><?php echo $Lang['People_Have_Seen']; ?></div>
        </header>
        <article class="art-content">
          <div id="p<?php echo $PostsArray[0]['ID']; ?>">
            <?php echo $PostsArray[0]['Content']; ?>
          </div>
          <div id="edit<?php echo $PostsArray[0]['ID']; ?>" style="width:648px;height:auto;" class="hide"></div>

          <div class="clearfix">
            <div id="TagsList" class="pull-left">
              <div id="TagsElements" class="pull-left">
              <?php
              if($Topic['Tags']){
                foreach (explode("|", $Topic['Tags']) as $Tag) {
              ?><a class="btn btn-default btn-sm" href="<?php echo $Config['WebsitePath']; ?>/tag/<?php echo urlencode($Tag); ?>" id="Tag<?php echo md5($Tag); ?>"><?php echo $Tag; ?></a>
              <?php
                }
              }
              ?>
              </div>
              <?php
                if($CurUserRole>=4 || $Topic['UserID']==$CurUserID){ ?>
              <span><a class="btn btn-primary btn-sm" href="###" class="edittag" onclick="javascript:EditTags();"><?php echo $Lang['Edit_Tags']; ?></a></span>
              <?php
                }
              ?>
            </div>

            <div id="EditTags" style="display:none;">
            <div id="EditTagsElements">
            <?php
            if($Topic['Tags']){
              foreach (explode("|", $Topic['Tags']) as $Tag) {
            ?><a href="###"  onclick="javascript:DeleteTag(<?php echo $ID; ?>, this, '<?php echo $Tag; ?>');"><?php echo $Tag; ?>&nbsp;×</a>
            <?php
              }
            }
            ?>
            </div>
            <input type="text" name="AlternativeTag" id="AlternativeTag" value="" class="float-left w200" placeholder="<?php echo $Lang['Add_Tags']; ?>" />
            <a href="###" class="edittag" onclick="javascript:CompletedEditingTags();"><?php echo $Lang['Complete_Edit_Tags']; ?></a>
            </div>


            <div class="pull-right">
            <?php
            if($CurUserRole>=4){
              if($Topic['IsDel']==0){
              ?>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 1, 'Delete', true, this);" style="float:right;"><?php echo $Lang['Delete']; ?></a>
            <?php
              }else{
            ?>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 1, 'Recover', false, this);" style="float:right;"><?php echo $Lang['Recover']; ?></a>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 1, 'PermanentlyDelete', true, this);" style="float:right;"><?php echo $Lang['Permanently_Delete']; ?></a>
            <?php
              }
            ?>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 1, 'Lock', true, this);" style="float:right;"><?php echo $Topic['IsLocked']?$Lang['Unlock']:$Lang['Lock']; ?></a>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 1, 'Sink', true, this);" style="float:right;"><?php echo $Lang['Sink']; ?></a>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 1, 'Rise', true, this);" style="float:right;"><?php echo $Lang['Rise']; ?></a>
            <?php
            }
            ?>
            <?php
            //if($CurUserRole>=4 || $Topic['UserID']==$CurUserID){
            if($CurUserRole>=4){
            ?>
            <a href="###" onclick="javascript:EditPost(<?php echo $PostsArray[0]['ID']; ?>);" style="float:right;"><?php echo $Lang['Edit']; ?></a>
            <?php
            }
            if($CurUserID){
            ?>
            <a href="###" onclick="javascript:Manage(<?php echo $ID; ?>, 4, 1, false, this);" style="float:right;"><?php echo $IsFavorite?$Lang['Unsubscribe']:$Lang['Collect']; ?></a>
            <?php
            }
            ?>
            </div>
          </div>
        </article>
        <!-- post main content end -->
<?php unset($PostsArray[0]);
      }
      if($Topic['Replies']!=0){
      ?>
        <!-- 回复内容列表开始 -->
        <footer>
          

<div class="title">
  <?php echo $Topic['Replies']; ?> <?php echo $Lang['Replies']; ?>  |  <?php echo $Lang['Last_Updated_In']; ?> <?php echo FormatTime($Topic['LastTime']); ?>
</div>
<ol class="list-unstyled">
<?php foreach($PostsArray as $key => $Post){
  $PostFloor = ($Page-1)*$Config['PostsPerPage']+$key;
?>
  <li class="comment-item clearfix">
    <a name="Post<?php echo $Post['ID'];?>"></a>
    <div class="comment-avatar pull-left">
      <a href="<?php echo $Config['WebsitePath'].'/u/'.urlencode($Post['UserName']); ?>">
      <?php echo GetAvatar($Post['UserID'], $Post['UserName'], 'middle'); ?>
      </a>
    </div>
    <div class="comment-content">
      <div class="container-fluid">
        <div class="clearfix">
          <div class="pull-left"><a href="<?php echo $Config['WebsitePath'].'/u/'.urlencode($Post['UserName']); ?>"><?php echo $Post['UserName'];?></a></div>
          <span class="pull-right">
            <?php echo FormatTime($Post['PostTime']); ?>&nbsp;&nbsp;
            <a href="#Post<?php echo $Post['ID']; ?>"><span class="commonet-count">#<?php echo $PostFloor; ?></span></a>
          </span>
        </div>
        <div id="p<?php echo $Post['ID']; ?>" class="container-fluid">
          <?php echo $Post['Content']; ?>
        </div>
        <div id="edit<?php echo $Post['ID']; ?>" style="width:588px;height:auto;" class="hide"></div>
      </div>
      <?php if($CurUserID){ ?>
      <div class="comment-button container-fluid">
        <div class="pull-left">
<?php
// if($CurUserRole>=4 || $Post['UserID']==$CurUserID){
if($CurUserRole>=4){
?><a href="###" onclick="javascript:EditPost(<?php echo $Post['ID']; ?>);" title="<?php echo $Lang['Edit']; ?>"><i class="fa fa-pencil-square-o"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;<?php } ?>
        <?php if($CurUserRole>=4){ ?><a href="###" onclick="javascript:Manage(<?php echo $Post['ID']; ?>, 2, 'Delete', true, this);" title="<?php echo $Lang['Delete']; ?>"><i class="fa fa-trash"></i></a><?php } ?>
        </div>
        <div class="pull-right">
          <a href="#reply" title="<?php echo $Lang['Reply']; ?>" onclick="JavaScript:Reply('<?php echo $Post['UserName'];?>', <?php echo $PostFloor; ?>, <?php echo $Post['ID'];?>);"><i class="fa fa-reply"></i></a>
<?php
if($EnableQuote){
?>
          &nbsp;&nbsp;&nbsp;&nbsp;
          <a href="#reply" title="<?php echo $Lang['Quote']; ?>" onclick="JavaScript:Quote('<?php echo $Post['UserName'];?>', <?php echo $PostFloor; ?>, <?php echo $Post['ID'];?>);"><i class="fa fa-quote-left"></i></a>
<?php
}
?>  
        </div>
      </div>
      <?php } ?>
    </div>
  </li>
<?php
}
if($TotalPage>1){
?>
<div class="pagination">
  <?php Pagination("/t/".$ID."-",$Page,$TotalPage); ?>
<div class="c"></div>
</div>
<?php
}
?>
</ol>






        </footer>

        <!-- 回复内容列表结束 -->
<?php } ?>
      <!-- 编辑器 开始 -->
<?php if($Topic['IsLocked'] || (!$Topic['IsLocked'] && !$CurUserInfo)){
      ?>
      <script type="text/javascript">
      loadScript("<?php echo $Config['WebsitePath']; ?>/static/js/reply.function.js?version=<?php echo $Config['Version']; ?>",function() {
        loadScript("<?php echo $Config['WebsitePath']; ?>/static/editor/ueditor.parse.min.js?version=<?php echo $Config['Version']; ?>", function(){
          RenderTopic();
        });
      });
      </script>
      <script type="text/javascript" charset="utf-8" src="<?php echo $Config['WebsitePath']; ?>/static/js/reply.function.js?version=<?php echo $Config['Version']; ?>"></script>
      <div class="ad">
        

<?php echo $Topic['IsLocked']?$Lang['Topic_Has_Been_Locked']:$Lang['Requirements_For_Login'];; ?>

      </div> <?php       }else{       ?>       <div class="title">         <?php echo $Lang['Reply']; ?><a name="reply"></a>        </div>       <div class="main-box">         <script type="text/javascript">         var MaxPostChars = <?php echo $Config['MaxPostChars']; ?>;//主题内容最多字节数         loadScript("<?php echo $Config['WebsitePath']; ?>/static/js/reply.function.js?version=<?php echo $Config['Version']; ?>",function() {           InitNewTagsEditor();           loadScript("<?php echo $Config['WebsitePath']; ?>/static/editor/ueditor.config.js?version=<?php echo $Config['Version']; ?>",function() {             loadScript("<?php echo $Config['WebsitePath']; ?>/static/editor/ueditor.all.min.js?version=<?php echo $Config['Version']; ?>",function(){               loadScript("<?php echo $Config['WebsitePath']; ?>/language/<?php echo ForumLanguage; ?>/<?php echo ForumLanguage; ?>.js?version=<?php echo $Config['Version']; ?>",function(){                 $("#editor").empty();                 InitEditor();                 loadScript("<?php echo $Config['WebsitePath']; ?>/static/editor/ueditor.parse.min.js?version=<?php echo $Config['Version']; ?>", function(){                   RenderTopic();                 });               });             })           });         });         </script>         <form name="reply">           <input type="hidden" name="FormHash" value="<?php echo $FormHash; ?>">           <input type="hidden" name="TopicID" value="<?php echo $ID; ?>">           

            <div id="editor" style="width:648px;height:160px;">Loading……</div>           

          <div class="float-left"><input type="button" value="<?php echo $Lang['Reply']; ?>(Ctrl+Enter)" class="textbtn" id="ReplyButton" onclick="JavaScript:ReplyToTopic();"/></div>                      

        </form>       </div> <?php } ?>       <!-- 编辑器 结束 -->        </section>            </div><!--首页主体结束-->          <!--边栏开始-->     <?php include($TemplatePath.'sider.php'); ?>     <!--边栏结束-->   </div>   <div class="row clearfix">        </div>    </div>


2 个回复 | 最后更新于 2015-10-22
2015-10-22   #1

编辑时候无内容,没传入相关值?DOM问题?

2015-10-22   #2

回复#1 @酷寒似暑 :

查看reply.function. js中编辑帖子相关函数,帖子内容是一个相对位置的DOM节点的内容,你加入id改成绝对位置。

登录后方可回帖

登 录
信息栏
购买PHP虚拟主机 / VPS

Carbon Forum是一个基于话题的高性能轻型PHP论坛

下载地址:Carbon Forum v5.0.1
QQ群:12607708(QQ我不常上)

donate

手机支付宝扫描上方二维码可向本项目捐款

Loading...