1 (edited by parkinm 2007-05-21 15:29)

Topic: Questions regarding why choices were made in the development in PunBB.

Hi I have downloaded a copy of PunBB to study it so I understand one way to approach making a php forum.

I have been going through the source code and now have a partial understanding of how it works but I wondered if some things could be clarified by the developers?

I have been looking into how punBB handles page structure, mainly regarding tpl files and output buffering. I understand how this works but I do not have that much experience with it nor do I understand the benefits yet.
My understanding is that the site structure is stored in a .tpl file as a mix of regular and custom tags.  The file is read into a variable (tpl_main) where it is searched, replaced and manipulated.  For each tag substitution a output buffer is used so that the contents arent instantly displayed but can be later output.

Why did you decide to store the page in a tpl file and thus also why have you chosen to use tag substitution? I have noticed that phpBB also uses tpl files. Is this some kind of standard? On my first glance it seems to be overly complicated just to build a page (all the string substitutions, replacing and searching) just to see the page in another page as custom tags.

Also why at the end of the footer was a exit used to output tpl_main - rather than an echo or print? Is there a particular reason for this?

I hope my questions dont offend you I am really impressed to see a fully compliant xhtml forum, I am just really curious to know why you made certain decisions on the methods you have used.

Thanks again

2 (edited by MattF 2007-05-21 15:42)

Re: Questions regarding why choices were made in the development in PunBB.

Personally, (I wouldn't presume to say this is how the PunBB Dev's think), the .tpl files, (which is an abbreviation for template), presents a standardised layout, whilst making parts, like messages, configureable. With the exit calls, they are placed within a script to prevent it from carrying on any further. This is usually to define what you want it to do before exiting, rather than what the script wants to do before exiting. big_smile I would presume, (and this is a personal presumption), that the exit is probably tied in to limit what debug info is outputted.

Re: Questions regarding why choices were made in the development in PunBB.

This is just a message to *bump*!

Thanks for your response Matt, but I would really like to hear from one of the Dev's from PunBB if possible!

4

Re: Questions regarding why choices were made in the development in PunBB.

From a markup perspective, .tpl files can be easily altered to include additional items for the purposes of integrating them into your existing website e.g. you can add banners, site menus and sidebars. It also makes it possible to easily move replaced items around without having to edit the php files.