I just created a BLOG Script. I’m using foreach to loop and display the posts. But now I want to create a template engine like WordPress. How can I do that? I’m new to PHP. I don’t have any idea to do this.
I tried using file_get_content. For example:
file_get_contents("template_dir/template_name/index.php");
But there is a problem with CSS and images. That’s my first problem. Anyone please help me to create this.
To bring in files you use
include()orrequire()However, I don’t see why so many people insist on trying to reinvent the wheel. If you are building a blog install WordPress and code your own WordPress theme. WordPress has been in development for years and is now not only one of the best blogging engines, but a very powerful cms capable of powering any type of site.