本帖最后由 sysmaze 于 2014-11-02 15:47:57 编辑

解决方案 »

  1.   

    你的 KSeeing::assign 方法是怎么写的?一般的说
    $tpl->assign("show",'success'); 
    是将 'success' 赋予 $tpl 的 show 属性,通常会有一个载体
    所以可能是这样 $tpl->data['show'] = 'success';你的模板中是 <?php  echo $show ?>
    所以 compile 方法中应是
    extract($this->data);
    include($comFile);
      

  2.   


    版主大人  compile这里面有个正则替换 我是故意在终极页面 写个变量$show = '111';  看看能不能输出 正常的应该是$tpl->assign("show",'success');function assign($tpl_var,$value = null){
                if($tpl_var!=''){
                    $this->vars[$tpl_var] = $value;
                }
            }
    现在的问题很纠结具体的情况是这样的   这是终极页面<?php 
        require "system/system.php"; 
        $tpl =  new KSeeing();
        $tpl->assign("show",'success');
        //$show = '111';
        include('templates/index.html');
        //include('F:/AppServ/www/temp/tpl/com_index.html.php');
        $tpl->compile('index.html');
    ?>
    目前的终极页面可以正常输出success 这是没问题的  然后我稍加修改<?php 
        require "system/system.php"; 
        $show = '111';
       
         $tpl->compile('index.html');
    ?>
    这样index.html里的$show就没值了,问题来了!!!如果我把$tpl->compile('index.html');改成 include('templates/index.html');就好使了!!而$tpl->compile('index.html');得到的结果也是include('templates/index.html');或者是绝对路径                        这样为啥就不好使了呢    目前表面问题看着像页面问题 
      

  3.   

    ===============================================
    2楼终极页面有个没注释   修改下<?php 
        require "system/system.php"; 
        $tpl =  new KSeeing();
        $tpl->assign("show",'success');
        //$show = '111';
        //include('templates/index.html');
        //include('F:/AppServ/www/temp/tpl/com_index.html.php');
        $tpl->compile('index.html');
    ?>
      

  4.   

    所以我要你给出 assign 方法的代码,这样才能有的放矢
    你在 compile 中 include 不行的元婴是 compile 中并没有变量 $show