I’m trying to implement the Subroutines feature from my old engine. It’s very useful when an entry contains repeating text or formatting. But obviously I don’t know enough yet. After spending two days with it, let me ask you what’s the problem.
What do I want?
I want a tag pair called [sub name]contents[/sub], which creates a [name parameters] tag for BBCode. This puts contents in the text, replacing placeholders with parameters. For example,
[sub keyboard](table)(tr)(td)%1(/td)………[/sub]
[keyboard Q W E R T ………]
This creates a template to display a keyboard with a table and put letters on it.
What did I do?
As for the parameter handling, I didn’t reach there yet. The problem is in an earlier stage. I „wrote” a function to create the [sub] tag:
The echo statements are just for debugging, of course. The line with // lists the BBCode tags database, and proves the new tag is registered.
Now we’re supposed to have a new tag (in the example, [keyboard]) in the database, and it has to call the third function, plugin_sub_execute, which is yet unwritten, there are only some debugging code there to notify the control is passing by. But it doesn’t.
What am I doing wrong? Sorry if it’s deadly obvious for the expert, but I’m just popped out from the egg.