0

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.

4
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by xapher19
0

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

0

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.

0

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?

0

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.

0

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 :/

0

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

0

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

0

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!

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.