Topic: PunBB Source Code!?

Hello all,

I was looking at some of the punbb source code and im sort of conerned about it because you guys(the developer(s)) didnt use nearly any PHP syntax such as the { and } on if, else, and elseif... statements and you also didnt use the PHP closing tag( ?> ) on any of the pages leaving the PHP page source open. Thats all.

Thanks!
-maddog39 big_smile

Re: PunBB Source Code!?

Now what are you talking about? tongue
If the code was missing {}s, then there would be a parse error when you tried to view it wink
and the closing tag isn't always needed (for example, config.php) and removing it can keep some errors from happening (like, excess whitespace after the end tag in config.php messing up the headers)

Re: PunBB Source Code!?

Thats easy to fix but my point its very unclean in my opinion. Also, if the {}'s are missing it would create a parse error. That style once existed in PHP/FI and PHP 3 a long long time ago when PHP was more like Perl than PHP.

Re: PunBB Source Code!?

{ } are not needed if there is only one line in the statment after the if, else, while, for, etc (see http://uk.php.net/manual/en/language.co … ctures.php and http://uk.php.net/manual/en/control-str … syntax.php)

?> is only needed if there is html after the php (you can think about it that <?php ends the html and ?> starts the html instead of inversely if that makes sense)

Re: PunBB Source Code!?

Connorhd wrote:

{ } are not needed if there is only one line in the statment after the if, else, while, for, etc (see http://uk.php.net/manual/en/language.co … ctures.php and http://uk.php.net/manual/en/control-str … syntax.php)

?> is only needed if there is html after the php (you can think about it that <?php ends the html and ?> starts the html instead of inversely if that makes sense)

What Connor said smile
And I thought he meant there was only a { or a }, not missing both tongue

Re: PunBB Source Code!?

Yeah I geuss that would make sense... big_smile

Re: PunBB Source Code!?

One of my concerns are that you are not separating logic from design. Writing out HTML code with echo ""; type strings is really bad. I would suggest using a PHP template system such as Smarty or (my favorite) Savant.

Re: PunBB Source Code!?

Afraithe wrote:

One of my concerns are that you are not separating logic from design. Writing out HTML code with echo ""; type strings is really bad. I would suggest using a PHP template system such as Smarty or (my favorite) Savant.

We've had many debates regarding template systems before. Fact is, most people have no use for an advanced template system such as Smarty or Savant. We're trying to keep things as simple and efficient as possible with PunBB. A massive template system doesn't quite fit the bill.

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

Re: PunBB Source Code!?

Rickard wrote:

such as Smartys or Savant

I am not a template system tongue
But I did find my name much cooler when I first heard about Smarty big_smile

10

Re: PunBB Source Code!?

About design ... ALL MUST BE IN DIV ! smile

With this, it would be possible to create great things smile DOM and XHTML are my friends. smile

Re: PunBB Source Code!?

Smartys wrote:
Rickard wrote:

such as Smartys or Savant

I am not a template system tongue
But I did find my name much cooler when I first heard about Smarty big_smile

You misquoted me! big_smile

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

Re: PunBB Source Code!?

*cough*silent edit*cough*

Re: PunBB Source Code!?

Sorry for late answer, but you should really look into using a template system (Savant beeing my suggestion). Savant is quite simple and effective in seperating design and code. You still write everything in PHP, not a seperate template language as Smarty uses.

It just kills me to see open source apps like this that doesn't use a template system, its so ugly to need to hack inside the code to change the layout etc.

Re: PunBB Source Code!?

what do you want to change? give an example of something you want to do which you can't with the current tpls and/or CSS?

15

Re: PunBB Source Code!?

Connorhd wrote:

what do you want to change? give an example of something you want to do which you can't with the current tpls and/or CSS?

Well, the code is really full of HTML.
And if you want to make a major change in appearance (not only colors / DIV behaviour) you might get into trouble because you have to do it all in the scripts.

Plus, it's more difficult to handle.
To write, install and test a mod that involves for example profile.php which has something around 1600 lines you spend lots of time uploading...

But then again, for most purposes you won't have to touch the code anyway.
Also it's major work to rewrite punBB that way. It's not done by just stuffing the HTML somewhere else (I know because I tried with my own template parser http://www.script.gr/go/scripts/STP/ and I gave up on it)

The German PunBB Site:
PunBB-forum.de

Re: PunBB Source Code!?

And if you want to make a major change in appearance (not only colors / DIV behaviour) you might get into trouble because you have to do it all in the scripts.

like what?

17

Re: PunBB Source Code!?

Actually you can make major changes to appearance with the style sheets though it does require a very thorough knowledge of positioning and/or float behaviour. Part of the problem is that most "skinners" cut their teeth on systems like phpBB and are used to accomplishing what they want with markup rather than css. The downside is that the markup needs to be heavier than strictly necessary because it has to be reasonably flexible.

I'm also not convinced that people who want to make major changes to the markup were PunBB's intended audience. If someone has a definite requirement for a templating system then why are they looking at PunBB in the first place?

Having said that one thing I would like to see introduced is custom .tpl files for styles as per codeXP's mod. That introduces a lot of flexibility for no overhead whatsoever. Its a very PunBB'ish thing to do as it is simply making the most use of features already available. AND I REALLY DO MEAN THIS smile

Re: PunBB Source Code!?

Paul wrote:

Having said that one thing I would like to see introduced is custom .tpl files for styles as per codeXP's mod. That introduces a lot of flexibility for no overhead whatsoever. Its a very PunBB'ish thing to do as it is simply making the most use of features already available. AND I REALLY DO MEAN THIS smile

Noted.

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