ואדים הקוד שלך ממש לא חכם,
בכל פעם שהוא ירצה עמוד חדש הוא יצטרך להכנס לדף ולהוסיף טקסט למערך , זה דיי טפשי.
הנה קובץ ה page שלי:
PHP קוד:
//Is this the main page?
if (isset($_GET['page']) && file_exists("sources/src_{$_GET['page']}.php"))
{
//If exists Class
if(file_exists("includes/{$_GET['page']}.class.php"))
include_once("includes/{$_GET['page']}.class.php");
//Include sources
include_once("sources/src_{$_GET['page']}.php");
$template = "tpl/master.tpl";
}
else {
//If exists Class
if(file_exists("includes/index.class.php"))
include_once("includes/index.class.php");
//
include_once("sources/src_index.php");
$template = "tpl/master.tpl";
}
//
בשביל להוסיף דף אתה פשוט פותח את הדף בתיקייה sources,
בנוסף אם תרצה קובץ מחלקה אתה פותח אותו בתקייה includes.
כמובן שהדף למעלה מאונקלד בתוך קובץ index שעושה פעולות נוספות שיש בהם צורך.
*היתרון הוא שאין צורך להיכנס לקובץ ה page במידה ואתה רוצה להוסיף דף /למחוק.