本帖最后由 seqq001 于 2014-06-12 13:13:00 编辑

解决方案 »

  1.   

    我用的Dreamweave  
    有什么好的工具可以推荐下
      

  2.   

    1、打开查看错误日志
    2、打印相关变量看看,在哪一行出现错误
    目测 $db不存在吧,dx3以后不支持这种写法了
      

  3.   

    <?
    $result=mysql_query("SELECT * FROM `bbs_forum_post` where tid ='$tid'");
    while($row=mysql_fetch_array($result)){
    ?>
    <?=$row[message]?>
    <?
    }
    ?>
    我的这个代码在独立页面可以运行,加入到模板页也是空白,是怎么回事
      

  4.   

    discuz有自己的数据库类 封装了很多方法 也包含安全过滤$query = $db->query("select * from bbs_forum_post where tid ='$tid' ");
    while($result = $db->fetch_array($query)) {
          $mythread[] = $result;
    }你这段 改成$tid = intval($tid);
    $mythread = DB::fetch_all('select * from '.DB::table('forum_post').' where tid = $tid');
      

  5.   

    10楼代码有误最后包含$tid的单引号改成双引号
      

  6.   

    谢谢  wander_wind弄好了,但是$tid =$_GET['tid'];这个得不到值我想让他在列表页每个帖子的下边出现,如何获得每个帖子的tid或都
    $mythread = DB::fetch_all('select * from '.DB::table('forum_post').' where tid = $tid');
    这一句能不能直接加到模板里,我加了显示空白,要是能加就简单多了
      

  7.   

    刚写错了$tid = intval($tid);我换了$tid =$_GET['tid'];  试试也不行
      

  8.   


    可以直接加进模板
    <!--{eval $mythread = DB::fetch_all('select * from '.DB::table('forum_post')." where tid = $tid");}-->
    eval 就是直接运行php的标签
      

  9.   

    想在forum_forumdisplay.php里加这个也行
    模板调用的帖子列表是$_G['forum_threadlist'],在末尾include template......引入模板的代码之前,遍历这个列表变量就可以处理
      

  10.   

    <a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1 || $thread['forumstick']} target="_blank"{else} onclick="atarget(this)"{/if} class="s xst">$thread[subject]</a>
    <div class="listjj"><!--{eval $mythread = DB::fetch_all('select * from '.DB::table('forum_post')." where tid = $thread[tid]");}--><!--{loop $mythread $key $val}-->
          {$val[message]}
           <!--{/loop}--></div>还是得不到 tid  
    <!--{eval $mythread = DB::fetch_all('select * from '.DB::table('forum_post')." where tid = $tid");}-->
    也不行
      

  11.   

    forum_forumdisplay.php
    这个文件里 我找不到 标题subject怎么定义的,要是加在它的下边就 不用单独找tid了吧
      

  12.   

    dz的模板很乱,可以确定那个位置是你的目标吗?随便写个<p>11111111</p>可以显示吗?
    实在不行就按15楼那样试试
      

  13.   

    <!--{eval $mythread = DB::fetch_all('select * from '.DB::table('forum_post')." where tid = $tid");}-->这里的tid 直接写上一个是可以显示的
      

  14.   


    那说明代码没错,看看$thread[tid]有什么问题,echo一下,或者用$tid=它,接收放进eval再试试
    今天偷偷水了好久csdn,还半小时下班,突击一下无聊的工作进度去
    兄弟你自己想想办法哈
      

  15.   

    谢谢  
    $thread[tid] 是不是不能放在<!--{eva  里边
      

  16.   

    <!--{eval $mythread = DB::fetch_all('select * from '.DB::table('forum_post')." where tid = $tid");}-->
    能在这里直接输出就好了