1

Topic: Templates

How about it? You could keep the simple system, and the speed and still have templates. Please?

Not having templates limits this boards usage, I for one would need to completely change the design to work with my website...

2

Re: Templates

Just look at the templates folder. There are the templates.
Besides from that, the next version will come with CSS full integration, which should make it much more customizable.

3

Re: Templates

There is no tremplates folder... hmm

Re: Templates

He is refering to the folder include/template/. In there you will find a few .tpl-files that will allow you to incorporate PunBB into your website design. However, a full-blown template system with individual templates for each part of the forum just won't happen. I've made a design choice not to include such a system and I'm sticking to it.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: Templates

Oh well sad

Re: Templates

0zone wrote:

Oh well :(

If PunBB had a template system, attachments, private messaging, polls etc. it wouldn't be any different or any better than all the other BB's out there. It's scaled down for a purpose you know.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7

Re: Templates

If you are going to do a completely customized design then even if PunBB used templates you would still have to customize them. There is no difference between customizing the markup in the php files and customizing markup in templates until of course there is an upgrade.

8

Re: Templates

Rickard wrote:
0zone wrote:

Oh well sad

If PunBB had a template system, attachments, private messaging, polls etc. it wouldn't be any different or any better than all the other BB's out there. It's scaled down for a purpose you know.

But I'm only asking that a basic template system be made so that I don't have to go through the source files and replace all the code that way.

Re: Templates

0zone wrote:
Rickard wrote:
0zone wrote:

Oh well :(

If PunBB had a template system, attachments, private messaging, polls etc. it wouldn't be any different or any better than all the other BB's out there. It's scaled down for a purpose you know.

But I'm only asking that a basic template system be made so that I don't have to go through the source files and replace all the code that way.

Yes, but such a template system would be a huge addition to the current codebase. Also, PunBB's lack of a template system is one of the things that make it fast.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

10

Re: Templates

Face it. Your only hope is that somebody else will feel the same as you do and come up with an alternative release of PunBB which includes templates.

11

Re: Templates

I think your right Paul. Rickard, thats not true, my template engine is only 20 lines long, its also fast and even supports if statements.

http://0zonedesign.hostcubed.com/smartbb/global.php

Look for 'protected function tpl_parse($template, $debug = false) {'.

Re: Templates

0zone wrote:

Rickard, thats not true, my template engine is only 20 lines long, its also fast and even supports if statements.

It's not the functions for loading/compiling etc. I consider a large addition to the code, it's rewriting every single script so that they utilize the templates.

You're executing no less than 8 preg_replace's for every single template and doing disk IO to load/save. I wouldn't call that fast when comparing it to direct static output. Say a page is built up of 20 templates. That equals 160 calls to preg_replace and 20 disk reads. That code will be MUCH slower than direct static output.

If I were you, I would save the compiled templates to disk and then just use include/require instead of loading them into memory and using eval(). That way PHP "accelerators" such as mmcache and Zend Optimizer can cache the PHP bytecode for the templates and your pages will generate much faster.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

13 (edited by 0zone 2004-02-22 23:01)

Re: Templates

I do save the templates to disk, but instead of including them each time they are needed I load them on their first request and then eval them. And yes eval is faster than including because include reads the file AND evals it.

My board is not slow at all mind you, it gets an average of a 0.025 loadtime. And yes, preg_replaces are slow, but as they are only called once when the template is compiled it doesn't matter.

EDIT: I will also be looking at a way to cut the number of preg_replaces down wink

Re: Templates

0zone wrote:

I do save the templates to disk, but instead of including them each time they are needed I load them on their first request and then eval them. And yes eval is faster than including because include reads the file AND evals it.

And how does that differ from reading the file manually and then evaling it?

Edit: *hits head* Now I see what you mean. That's true. However, your method doesn't at all take advantage of the benefits of PHP accelerators such as mmcache, PHPA and Zend Optimizer.

0zone wrote:

My board is not slow at all mind you, it gets an average of a 0.025 loadtime. And yes, preg_replaces are slow, but as they are only called once when the template is compiled it doesn't matter.

I never said your board was slow. I just said using templates in that matter, or any matter for that matter (no pun intended), will be a lot slower than just outputting static markup.

Also, the average loadtime for your board doesn't tell me anything. 0.025 could mean it's blistering fast, but it could also mean it's incredibly slow. Heck, I can get huge boards like vBulletin or IPB to load that fast under the right circumstances. Loadtimes are only interesting when comparing them to other boards on the same hardware and with the same data. The variables that affect loadtimes are endless. What kind of hardware the board is running on, the versions of all used tools (Apache, PHP, MySQL etc.), whether a PHP accelerator is used or not, the number of users/topics/posts in the database, the number of board features enabled, what kind of concurrency was used when running the benchmarks (i.e. what value for -c when running apachebench), etc. etc. etc.

We could talk about this forever. The fact remains: PunBB will not have a template system in any forseable future. I have to draw the line somewhere if PunBB is to remain the "faster, smaller and less graphic alternative". PunBB 2.0 (whenever that may be) will most likely be styled completely with CSS and then a template system won't be needed.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

15

Re: Templates

Thats all ok, excluding the css part.

CSS can style things, but it can't put things together. Its only capable of so much. You don't see designers using the same code over and over to get differant looking websites do you? No.

16

Re: Templates

0zone wrote:

Thats all ok, excluding the css part.

CSS can style things, but it can't put things together. Its only capable of so much. You don't see designers using the same code over and over to get differant looking websites do you? No.

Yes you do.
http://www.csszengarden.com/
Same markup, dozens (or more) different sites.

17 (edited by 0zone 2004-02-23 04:20)

Re: Templates

At that level you can, but say I wanted to have the user post information (from, registered and posts) in another order you couldn't.

And also, you can't uze css to replace 'Home | User list ...' with 'Home : User list ...'.