خطأ برمجي لا افهم سببه

السلام عليكم

من المفروض اني اعمل ع محرك قوالب , ومن خلال التعابير القياسية اضيف الحالة الشرطية للمحرك , هنا سطر الكود :

                // تحويل كل ما هو داخل <if con=""> الي شرط   
        $this->output = preg_replace('/<if con="(.*)"\s*>/i','<?php if($1){ ?>',$this->output);

            // إغلاق الشرط  
        $this->output = preg_replace('/<\/if>/i','<php } ?>',$this->output);

لكن في حالة تجربة الاداء يظهر الخطأ :

Parse error: syntax error, unexpected end of file in C:\wamp\www\ht.html on line 366

مع العلم ان السطر 36 في الاصل هو وسم اغلاق الـ html

فهل من اي تفسير !؟

يرجى الدخول لحسابك أو تسجيل حساب لتستطيع إضافة تعليق
حساب جديد دخول

التعليقات

أنت ناسي العلامة ? في بداية وسم php في السطر الأخير. غير السطر بهذا :

$this->output = preg_replace('/<\/if>/i','<?php } ?>',$this->output);

قم بتغيير لاحقة الملف إلى php.

مذا تفعل ب $this->output بعد ذالك ؟ هل تضعها داخل eval() ؟

فضلا ضع الكود كاملا .

اسف ع التأخير , بعد عدد من المحاولات ظهر خطأ جديد وهو :

Parse error: syntax error, unexpected '<' in C:\wamp\www\ht.html on line 23

هنا اكواد القالب بالكامل :

<?php

CLASS W3_TEMPLATE{

var $cache; // مجلد الكاش  
var $variable; // مصفوفة المتغيرات العامه في النظام  
var $output; // المخرجات  
var $input; // المدخلات  
var $temp;// مكان القوالب  

// التحقق من اصدار PHP واعداد القيم
public function __CONSTRUCT($template,$cache){

    if(phpversion() < '5.0.0') die("Error : Please Upgrade Your PHP To 5.0.0 Or later"); // التحقق من اصدارPHP
    $this->temp = $template; // متغير مجلد القوالب
    $this->cache = $cache; // مجلد متغير الكاش
    $this->variable = $GLOBALS;

}#Close function constructor

// دالة جلب القوالب
public function GET_TEMPLATE($filename){

    if(!file_exists($this->temp)) die("Error: the folder ".$this->temp." is not found"); //التحقق من وجود مجلد القوالب
    if(!file_exists($this->temp.'/'.$filename)) die("Error: ".$this->temp.'/'.$filename." is not found");//التحقق من وجود القالب المطلوب
    $this->input = file_get_contents($this->temp.'/'.$filename); // استعداء القالب
    return $this->input;

}#Close function GET_TEMPLATE


// التحقق من اجراء اي تعديلات ع القالب
public function chack_size($filename){

    $chack = @fopen($filename,r);
    $read  = @fread($chack,@filesize($filename));
    @fclose($chack);
    return $read;
}#Close Function chack size

// معالجة اكواد القالب الى php
public function replace_var(){

        // تغير كل ما هو بين {} الي متغير عام  
    $this->output = preg_replace('/{(.*)}/','<?php echo $this->variable[\'$1\']; ?>',$this->input);   
        // عمل  جلب داخلي  للقوالب عن طريق دالة ouput سنعرضها بعد قليل 
    $this->output = preg_replace('/<!--include:(.*)-->/','<?php $this->output(\'$1\');?>',$this->output);  

        // تحويل كل ما هو داخل <if con=""> الي شرط   
    $this->output = preg_replace('/<if con="(.*)"\s*>/i','<?php if($1){ ?>',$this->output);

        // إغلاق الشرط  
    $this->output = preg_replace('/<\/if>/i','<?php } ?>',$this->output); 


            return $this->output; // الرجوع بالتعديلات كمخرجات   
}#Close Function Replace Var



// الداله تأخذ  مدخل  واحد و هو اسم  ملف  القالب  
public function display($filename){


            //تحويل كل العلامه / الي - حتي  لا يتم استغلالها في  جلب ملفات خارج مجلد القوالب       
    $filename = str_replace('/','-',$filename);

            //استدعاء القالب   
    $this->GET_TEMPLATE($filename);

            // معالجة الاكواد وتحويلها الى php  
    $html = $this->replace_var();  

            //استخدام الخاصيه كاش التي تحمل اسم  مجلد الكاش و اسم الملف  المدخل حتي  نقوم  بجلبه فيما  بعد   
    $name = "$this->cache/$filename.php";

            // فتح الملف في  مجلد الكاش للتأكد من ان الملف به  تغيرات حتي نقوم بعمل التعديلات عليه  
    $check = $this->chack_size($name);  

        // التأكد من انه يوجد اختلاف  بين المدخلات و المخرجات حتي  نقوم بالتعديل  
    if($check != $html){  
            // التعديل علي ملف القالب داخل الكاش بالتعديلات التي تم عملها  
     $file = @fopen($filename,w);  
     $write = @fwrite ($file,$html);  
     @fclose($file);  
        }  

            // جلب الملف من داخل مجلد الكاش  
   include_once("$filename");  

}#Close function Display

}#Close class W3


هنا اكواد ملف الـ Html :

<!DOCTYPE html>

    <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
    Remove this if you use the .htaccess -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>HTML</title>
    <meta name="description" content="">
    <meta name="author" content="mohammedshaker">

    <meta name="viewport" content="width=device-width; initial-scale=1.0">

    <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
</head>

<body>

            <if con="{mm} == 1" >

      true  
    </if>


</body>

وانا ايضا اعاني من نفس المشكله لا افهم سبب ظهورها لي في كل مره

خطا في وسم اغلاق html

<?php

require_once 'php_action/db_connect.php';

session_start();



$errors=array();



if($_POST){

    $username = $_POST['$username'];

    $password = $_POST['$password'];



if(empty($username) || empty($password)) {

    if($username == "") {

        $errors[] = "Username is required";

    } 



    if($password == "") {

        $errors[] = "Password is required";

    }

}else{

    $sql="SELECT * FORM users WHERE username = '$username'";

    $result = $connect->query($sql);



    if($result->num_rows==1){

        $password = md5($password);



        $mainsql = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";

        $mainResult = $connect->query($mainsql);



        if($mainResult->num_rows == 1){

            $value = $mainResult->fetch_assoc();

            $user_id = $value['user_id'];



            $_SESSION['userId'] = $user_id;

            header('location:
        } else{

            $errors[] = "Incorrect username/password combination";

        }

    }else{

        $errors[] = "Username dosnot exists";

    }

}

?>

<!DOCTYPE html>

<title>Stock Management System</title>
<!-- bootstrap -->

<link rel="stylesheet" href="assests/bootstrap/css/bootstrap.min.css">

<!-- bootstrap theme-->

<link rel="stylesheet" href="assests/bootstrap/css/bootstrap-theme.min.css">

<!-- font awesome -->

<link rel="stylesheet" href="assests/font-awesome/css/font-awesome.min.css">

<!-- custom css -->

<!-- jquery -->

<script src="assests/jquery/jquery.min.js"></script>

<!-- jquery ui -->

<!-- bootstrap js -->

<script src="assests/bootstrap/js/bootstrap.min.js"></script>
    <div class="row vertical">

        <div class="col-md-5 col-md-offset-4">

        <div class="panel panel-info">

                        <div class="panel-heading">

                    <h3 class="panel-title">الرجاء تسجيل الدخول</h3>

                </div>

  <div class="panel-body">

            <div class="messages">

                        <?php if($errors) {

                            foreach ($errors as $key => $value) {

                                echo '<div class="alert alert-warning" role="alert">

                                <i class="glyphicon glyphicon-exclamation-sign"></i>

                                '.$value.'</div>';                                      

                                }

                            } ?>

                    </div>



                    <form class="form-horizontal" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" id="loginForm">

                        <fieldset>

                          <div class="form-group">

                                <label for="username" class="col-sm-2 control-label" dir="rtl" lang="ar">اسم المستخدم</label>

                                <div class="col-sm-10">

                                  <input type="text" class="form-control" id="username" name="username" placeholder="اسم المستخدم" autocomplete="off" />

                                </div>

                            </div>

                            <div class="form-group">

                                <label for="password" class="col-sm-2 control-label" dir="rtl" lang="ar">كلمة المرور</label>

                                <div class="col-sm-10">

                                  <input type="password" class="form-control" id="password" name="password" placeholder="كلمة المرور" autocomplete="off" />

                                </div>

                            </div>                              

                            <div class="form-group">

                                <div class="col-sm-offset-2 col-sm-10">

                                  <button type="submit" class="btn btn-default"> <i class="glyphicon glyphicon-log-in"></i> تسجيل</button>

                                </div>

                            </div>

                        </fieldset>

                    </form>

   </div>

 </div>

            </div>

        </div>

    </div>

</div>