For the project I'm working on, it has to have a changeable template system, so the users can make their own HTML templates to work with the system. However, I have no clue how to even go about doing this. Any help would be appreciated, thanks.

Recommended Answers

All 10 Replies

For the project I'm working on, it has to have a changeable template system, so the users can make their own HTML templates to work with the system. However, I have no clue how to even go about doing this. Any help would be appreciated, thanks.

I'm interested to see any other solution apart from templates and PHP include

You'll have to create a script that takes a template file and processes it. Come up with some simple syntax that is then replaced with content (for example, <!--# footer #--> or [[[footer]]] to create a footer placeholder).
Or, you could just make them type <?= $footer; ?>, and include the file. That way, they can also use PHP, which is nice, but you'll have to decide if that's what you want for youself.

I was thinking it'd be more like how phpBB do their template systems. Like, using "{variable}" in the HTML template file which then relates to a PHP variable in the language file.

I think I have an idea of how to do it though, just by creating a basic template file and the user edit that as the custom template. It'd be relatively simple to do as well. Just some basic PHP includes to include the template file, then the rest is easy using a language file. Thoughts?

Well, if you use {variable} or something like that you'll have to read and process the page, not include it, but that should be obvious.

I'm not that experienced in PHP to be perfectly honest, I know how to do quite a bit, but a lot of it I'm still learning. Maybe I'm going a bit out of my depth with this :/

I'm not that experienced in PHP to be perfectly honest, I know how to do quite a bit, but a lot of it I'm still learning. Maybe I'm going a bit out of my depth with this :/

If so then for now just use PHP include and put sections in php files

I think that's probably the easiest way for now. Thanks for the help anyway :3

I think that's probably the easiest way for now. Thanks for the help anyway :3

You are welcome :)
You can mark it solved if you think it is!

I am interesting in template making by use PHP.
I need to make it by myself.

I've been looking over scripts like Smarty, which do basically what I want. But it's just confusing as to how it works :S

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.