当以http://../phpcms/admin.php打开浏览器时,admin.php的最后一句包含了/admin/index.inc.php。此时由于没有action传入,因此命令被路由到了switch语句块的default部分。而在default中include了/admin/templates/index.tpl.php,该文件代码如下:
<?php
defined('IN_PHPCMS') or exit('Access Denied');
include admintpl('header');
?>
<frameset name="main" rows="48,*" frameborder="no" border="0" framespacing="0" cols="*">
<frame name="top" noresize scrolling="no" src="?mod=phpcms&file=index&action=top">
<frameset cols="170,*" frameborder="no" border="0" framespacing="0" rows="*">
<frame name="left" noresize scrolling="yes" src="?mod=phpcms&file=index&action=mymenu">
<frame name="right" noresize scrolling="yes" src="?mod=phpcms&file=index&action=main">
</frameset>
</frameset>
<noframes></noframes>
</html>
这就是后台的柜架部分。它包含了top,left,right三部分。而这三部分要显示,就必须调用src所指的文件。这里可以看出,src所指的文件其实还是admin.php,只是这回多了几个参数。top显示时,它将链接admin.php? mod=phpcms&file=index&action=top。于是,程序又开始从admin.php的第一句开始执行,最后一句include了/admin/index.inc.php,此时,由于action=top,因此程序进入了switch的top语句块。该语句块简单的include了/admin/templates/index_top.tpl.php。在该文件中主要是调用menu显示了top菜单。
同理,left和right中最后显示的内容是从/admin/templates/index_left.tpl.php,index_right.tpl.php中取得的。