这个结构/方法叫什么?

时间:2014-04-17 22:24:04

标签: php html methods structure

我一直在使用这个文件结构一段时间了,我不知道我从哪里得到了这个想法(可能是PHPBB?也许是Wordpress?)

基本上,我创建了一个页面,例如index.php。在索引里面,我使用php来require_once头部/元信息(我称之为meta.php)。在这个meta.php中,我包含了所有全局脚本和样式表,以及页面所需的任何其他内容,如视口。

然后我关闭了index.php中的head部分,它允许我添加任何特定的链接,比如特定的CSS或特定的javascript,并且还允许我在必要时更改页面的标题。

关闭头部后,我启动<body>并给它一个id的页面名称(您将在下面的示例中看到)。

打开正文后,我会添加标题,该标题是全局的,并具有导航和网站标识。

然后我包含另一个目录中的页面内容

然后我在其中加入了包含末尾</body></html>标记的页脚。

这是我的index.php的一个例子:

<?PHP 
    $currentFile = explode("/", $_SERVER["PHP_SELF"]); //Get the current URL name
    $fileName = end($currentFile); //Get the current File name
    $baseName = explode(".", $fileName); //Get the name without .php
    require_once('global/meta.php'); //Include the meta information
?>
    <!-- Add extra scripts and meta information per page here -->
    <title>Custom Page Title</title>
</head>
<!-- Change the ID to whatever the page is called to allow for the right navigation to show as active -->
<body id="<?= $baseName ?>"> 
<?PHP
    require_once('global/header.php'); //This is the end of the header
    require_once("pages/" . $baseName[0] . "/" . $fileName); //This is the content of the page
    require_once('global/footer.php'); //This is the footer of this page
?> 

我的文件结构如下:

/global/
    /images/
    /scripts/
    /styles/
    footer.php
    header.php
    meta.php
/pages/
    /index/
        /images/
        /scripts/
        /styles/
        index.php
index.php

我试图找出这个文件结构或方法的名称。这不是MVC框架,对吧?这有什么叫做什么,有没有人看到很多这方面的问题?

0 个答案:

没有答案
相关问题