السلام عليكم ورحمة الله وبركاته
حاولت برمجة محرك قوالب لمجلتي يعتمد على قواعد البيانات Mysql ثم يطبع المحتوى داخل ملف Html ثم يقوم بطلب الملف حيث أنه عند وجود الملف لا يقوم بطباعة المحتوى
وهذا الكود البرمجي

كود PHP:
<?

/*
 محرك قوالب يعتمد على قواعد البيانات
*/

$defultstyle 1;

   class 
display
   
{

      global 
$defultstyle;

          
$sql_style         = @mysql_query("SELECT * FROM style where idstyle=$defultstyle")
                               or die (
"خطأ في جلب جدول الستايل");
          
$tpl_style         = @mysql_fetch_array($sql_style);

         function 
_assign($tpl,$var,$definie)
            {
           
$tpl eregi_replace($var,$definie,$tpl);

         }

         function 
_Head($name_title)
            {
          
$tpl_style[thm_dir]       = stripslashes($tpl_style[thm_dir]);
          
$path_dir                 $tpl_style[thm_dir]."/".$tpl_style[cache];
          
$file_dir                 $path_dir."/head_".$name_title.".ch";
          
$readfile                 = @fopen($file_dir,"r");

           if (!
$readfile)
           {
              
// get seo sql
              
$sql_seo     = @mysql_query("SELECT * FROM seo ") or die ("خطأ في جلب جدول seo");
              
$tpl_seo     = @mysql_fetch_array($sql_seo);

              
// for title and css
              
$tpl_style[Head]       = stripslashes($tpl_style[Head]);
              
$tpl_style[css]        = stripslashes($tpl_style[css]);

              
// for seo
              
$tpl_seo[keywords]       = stripslashes($tpl_seo[keywords]);
              
$tpl_seo[description]    = stripslashes($tpl_seo[description]);
              
$tpl_seo[copyright]      = stripslashes($tpl_seo[copyright]);
              
$tpl_seo[author]         = stripslashes($tpl_seo[author]);
              
$tpl_seo[classification] = stripslashes($tpl_seo[classification]);
              
$tpl_seo[robots]         = stripslashes($tpl_seo[robots]);
              
$tpl_seo[revisit-after]  = intval($tpl_seo[revisit-after]);


              
$this->_assign($tpl_style[Head],'{title}',$name_title);
              
$this->_assign($tpl_style[Head],'{css}',$tpl_style[css]);
              
$this->_assign($tpl_style[Head],'{keywords}',$tpl_seo[keywords]);
              
$this->_assign($tpl_style[Head],'{description}',$tpl_seo[description]);
              
$this->_assign($tpl_style[Head],'{copyright}',$tpl_seo[copyright]);
              
$this->_assign($tpl_style[Head],'{author}',$tpl_seo[author]);
              
$this->_assign($tpl_style[Head],'{classification}',$tpl_seo[classification]);
              
$this->_assign($tpl_style[Head],'{robots}',$tpl_seo[robots]);
              
$this->_assign($tpl_style[Head],'{revisit-after}',$tpl_seo[revisit-after]);


               
// content of th head
               
$print_head       $tpl_style[Head];


              
// check the folders and the files
              
if(!is_dir($path_dir))
              {
                
$mkdir          = @mkdir ($path_dir0755true);
                @
fclose ($mkdir);
              }

              
$writefile       = @fopen($file_dir,"w");
              
$addtofile       = @fwrite($writefile,$print_head);


              @
fclose ($writefile);
              @
fclose ($addtofile);
              @
mysql_free_result($sql_seo);
           }

           @
fclose ($readfile);
           @
mysql_free_result($sql_style);

           include(
$file_dir);  // head template file
         
}
 }
?>
أعذروني إن كانت هناك أخطأء فأنا مبتدأ
الاسئلة
هل هذا المحرك مجدي ؟
ماهي عيوبه؟
كيف أقوم ببرمجة ادوت الشرط لكي يقوم العمل بها تلقائيا مثل محرك سمارتي?
أرجو الإجابه في أقرب وقت