How to document configuration directives

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Hmm... I think I'll defer writing the configuration generator till later. But sounds like an interesting side project.
Why have you choosen to write this for PHP 4?
That's an interesting question, especially considering the fact that PHP 6 is on the horizon and the fact that all my webhosts run PHP 5. I suppose it's just to acheive maximum penetration: people ought to be able to use it in PHP 4 and PHP 5. Interestingly enough, I use PHP 5.1.4 for active development, and then switch to older versions to do spot-testing. The syntax is a small price to pay for actually quite easy backwards-compatibility: I've had very few problems with PHP 4 compat. In short: it's not that big of a deal to support PHP 4, so why not?
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

AC wrote:so why not?
No data hiding, no interfaces, no reflection, no spl, no exceptions etc. These are things I can't do without.
Mind you I am writing a big framework of code that specifically focuses on organisation and you are just really writing a very large algorithm so I think your reasons for choosing PHP 4 may well be justified. Personally would have gone for PHP 5 myself.
PHP 6 is on the horizon
I thought it was an undisclosed time away, do you know something?
*ole leans closer*
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

ole wrote:OT sorry:
AC wrote:

Code: Select all

var
Why have you choosen to write this for PHP 4?
Why not? You can support multiple versions of PHP... especially if you want many people to actually use the software. I support two versions when I write code for public release.

EDIT | I run two versions though.... I don't use "var" in PHP5 code.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Actually, I ignored all suggestions and went about and did this:

Code: Select all

HTMLPurifier_ConfigDef::define(
    'Attr', 'IDBlacklist', array(),
    'Array of IDs not allowed in the document.');
Comments?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

With that it's easy to make self-documenting code: just make define to assemble help-file for you
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Precisely. The only problem is that SimpleTest pukes on E_STRICT warnings in their test files (that throws E_STRICT because the function definition isn't declared static), so I had to use some hack-tastic manuevers in order to get it to work. Hrm... well, it'll do for now.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

My hack to "fix" SimpleTest's E_STRICT breakage: edit the files. Since all releases forward of SimpleTest will be written for PHP5+ I had no problem doing it. Sure, I could have removed the E_STRICT, but I'd rather fix the problem then hide it.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Ehh... but then what about PHP 4 compatibility? (I can't stick static in there).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I don't care about PHP 4. Forgot about your wish to support... it. :)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Well, I can't program in E_STRICT because SimpleTest throws too many darn E_STRICT errors when I do that. Maybe when Marcus releases the PHP 5 version (SimpleTest 2.0) I'll drop PHP 4 support. I haven't checked out any of SimpleTest's unreleased development code (although I am using 1.0.1alpha3), how does it shape up?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm running 1.0.1alpha3 right now, so I've gone through and modified a lot of the code (using a regexp replace.)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Heh. I suppose that if SimpleTest is written well enough (which it is), all you'd need to do is add static, public and friends willy-nilly in order to get it up to shape. Still have the regexp?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Sorry no. But I can put the files on my server.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

That would be cool.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Maybe when Marcus releases the PHP 5 version (SimpleTest 2.0) I'll drop PHP 4 support
I could ask him next time I see him when that might be if you like.
Post Reply