So... Dragooon, what do you think we could do, either by adopting ToxG or by using a purely PHP solution?
Re: Plugin hooks
« Reply #60, on March 30th, 2011, 05:32 PM »
So... Dragooon, what do you think we could do, either by adopting ToxG or by using a purely PHP solution?
![]() | The way it's meant to be |
2 things id like to comment on: integration hook system and template system. Integration hook system. Think of a switch statement. You have a list of conditions and a default. The very nature of a switch is faster than a nested if.
Make a small c prog and look at the machine code/object code.
Instead of waiting till you get there to ask and see if there is a hook, already know when you get there. The theory is in my head but it is difficult to express in words. Each action has a path. Find out if that action has a hook then contenue through the action then knowing the path needed to go. Make hooks one of the first things done when an action is requested by way of a switch.
Use switches in every possible time, instead of ifs.
Dont use memory/hd unless there is no other way to do it. Mysql and apache are already using resourses, reuse those in every conceivable fashion instead of drawing more resources. If you dont need a particular setting, dont load it. Even comments generate more lines of code cause it has to determine if it is a comment or not.
Think of a switch statement. You have a list of conditions and a default. The very nature of a switch is faster than a nested if. Make a small c prog and look at the machine code/object code.
Find out if that action has a hook then contenue through the action then knowing the path needed to go.
Make hooks one of the first things done when an action is requested by way of a switch.
Template system. 100% static.
Only echo predefined values. Gives modders a way of changing the template, without changing the template.
Mysql storable, cacheable.
Different templates for different days, so to speak
Use switches in every possible time, instead of ifs.
Dont use memory/hd unless there is no other way to do it.
Mysql and apache are already using resourses, reuse those in every conceivable fashion instead of drawing more resources.
If you dont need a particular setting, dont load it.
Even comments generate more lines of code cause it has to determine if it is a comment or not.
What im saying is, preprocess, process, display using as few steps as possible.
Dragooon, I thought you said you had a PHP template hook in mind?
Dragooon, hooks aren't a sad practice. They're actually one of the most practical solutions to the problem of customizability... The only point is that we have to be careful how fast execution of empty points is.
Basically, in Wedge, it's as fast as en empty() test. At this rate, we could very well set hooks every other line in the code without it becoming significantly slower. (We will, instead, stick to adding hooks where it seems reasonable enough. We will probably add more hooks during the alpha and beta sessions at the request of modders.)
I do hope PHP in Wedge's templates isn't taken out, since thats whats currently keeps my interest lmao. :)(not that I expect Wedge to stop because of me though ;) )
I have spoken in favor of TOXG before, but I just don't see the kind of freedom with it that PHP templates providest, sorry to say. If anything it seems more cumbersome to MIMIC using PHP than just use PHP right away.. The mod/theme problem is VERY well solved by it though..but if there won't be a problem why use it then?
As for templates not being allowed to use PHP, because its "dangerous" or "not to be trusted"..wake up I'd say. One of most widespread scripts around use PHP in their templates(and not only WP either) and they haven't wreaked havoc yet! I would imagine that for those that seldom make templates or just change a color here and there, the idea of using nice formatted HTML that fit just right into Dreamweaver, is a must-have.
For everyone else though, the benefits are very clear. And last I checked it was the actual CONTENT that was considered risky allowing too much freedom for - not the design.
I like my car to go from spot 1 to 2 without breaking down and being reasonably fast. I don't care if it can actually fly because theres no allowed areospace for it to fly in anyway...
TOXG was made by Unknown to solve a specific problem. If said problem doesn't exist anymore(or will not exist)...why have that car with wings that you can't use? It would actually require more resources(=fuel) because of the added "feature".
Just saying. :)Posted: March 31st, 2011, 06:40 PM
oh, and talking of doing stuff in tempaltes which isn't possible otherwise..there just isn't many(=none) around that actually utilize the power of said PHP we have now - in SMF - so I won't hold my breath that TOXG will be any different in that respect.