CMS永久链接和模板系统如何?
我想了解如何在 php 网站上使用模板系统和永久链接:D!..
让我更多地描述一下我自己,
1.目前我有 20 个文件,每个文件都有自己的 php 逻辑(index.php、wizard.php、search.php)。 PHP 等) 全部使用相同的类并包含。(install.php 包括我的项目中所有类的所有必需的 abd u require_once(install.php) 在所有文件中)
我想将我的网站改造成。
Analyze URL requested ---> IDENTIFY requested page ---> GET TEMPLATE for THIS PAGE -->MODIFY header(meta) and footer(javascript) ---> add logic ---> display page :D.
有人能让我走上正确的学习轨道吗:D!。因为我用 oop 完全编码了我的网站,并使其所有内容从 MYSQL(简单的小型 CMS)动态加载,但我不知道如何将模板和 php 加入索引,而无需重复我自己并为我的网站中的每个页面创建不同的文件! (当然每个文件都做不同的工作,比如文件 users.php 负责登录、注册和用户配置文件等)
希望我的英语不是太差,你能理解我的问题:D!
到目前为止我目前的方法:
Mysql 表:page_tbl 列:页面名称、逻辑文件、模板文件、元标记。
index.php?pagename
将检查是否尚未缓存或未列出以进行追踪:
Mysql:SELECT * WHERE pagename='$_GET['page']'
loginfiles = cars.php,search.php (将用 , 进行分解并包含在内) 模板文件=也会根据MetaTag进行分解和修改。 Metatag:序列化关联数组,['name']=['value'];
然后我开始缓冲输出,用新的描述和关键字替换模板(自动生成) 包含逻辑文件 包括 footer.php (其中包括脚本)
我接近正确的路线还是还很远?还是我失去了踪迹并过度杀戮
I want to understand how to use templating system and permalinks on php websites :D !..
let me describe my self more,
1.currently i have 20 files each have its own php logic (index.php,wizard.php,search.php etc)
ALL use same class's and includes.(install.php include all the required for all class's in my project abd u require_once(install.php) in all files)
i wana remodel my website into.
Analyze URL requested ---> IDENTIFY requested page ---> GET TEMPLATE for THIS PAGE -->MODIFY header(meta) and footer(javascript) ---> add logic ---> display page :D.
can some one put me on right learning track :D !. cuz i hv coded my website fully in oop and made all its content loads dynamically from MYSQL (simple small CMS) but i have no clue how to join template and php into index without repeating my self and create different file for each page in my web ! (each file do different jobs of course like file users.php does login and registration and userprofile etc)
Hope my english wassnt too too bad and u could understand my question :D !
My current approach so far:
Mysql table : page_tbl
columns: pagename,LogicFile,templateFile,MetaTag.
index.php?pagename
will check if not already cached or not listed for chacing it will :
Mysql:SELECT * WHERE pagename='$_GET['page']'
loginfiles = cars.php,search.php (will be exploded with , and included)
Template files = will be also exploded and modified according to MetaTag.
Metatag: Serialized assoc array with ['name']=['value'];
Then i start buffer output , replace template with new descriptions and keywords(auto generated)
include logic files
include footer.php (which include the scripts)
am i near to correct rout or still far away ? or am did i lose my track and over killing
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不确定是要自己编写还是使用现有的。
话虽如此,有很多模板系统,smarty 是最长寿的一个。您可以在 phpbuilder 找到关于 5 个流行的简短讨论< /a>.
您还可能需要考虑整个框架。它们不仅仅是一个模板系统,还包括数据库、ajax 助手等。 Zend、CakePHP 和 Codeigniter 是流行的。您可以在 phpframeworks 上找到这些内容的比较。
If you are unsure whether you want to write your own, or use an existing one.
That being said there are plenty of templating systems, smarty being the most long-lived one. You can find a short discussion on 5 popular ones at phpbuilder.
You also have entire Frameworks that you might want to consider. They are more than just a templating system, where database stuff, ajax helpers etc are included. Zend, CakePHP, and Codeigniter being popular ones. You can find comparisons of these at phpframeworks.
最好的方法是采取这种路线:
这就是框架的工作方式,而且还不错。 ;]
The best way is to take this route:
This is the way the frameworks work, and it isn't that bad. ;]