Jamie Poitra - 28 January 2008 08:01 PM
Why were you hiding who you were? 
I wasn’t, really. I’d created this account for my first EE-based client project, and the KKCJ login for a different client. Different accounts, different purchases, “Topic reply notification” emails sent to different addresses… it makes sense. Really. 
Although this extension would/will be equally relevant for any of my clients, so whatever. :p
Jamie Poitra - 28 January 2008 08:01 PM
I found the extension dev docs a little confusing at first too. The thing is, its really going to be a little different depending on the hook. Thats why the dev docs are a little vague.
Here is the gist of it though.
You create your extension like the docs say with the hook you chose.
In the extension install you have specified a method. The method is the part of your extension that does all of the work.
Depending on the extension hook you have chosen your method will have different things available to them. For instance the edit_template_start hook has three variables available to it:
$query
$template_id
$message
You would call those in your method like this:
function my_method($query, $template_id, $message)
{
}
The hook will pass off the variables to your method. Your method does its thing and if appropriate returns a value once it’s done.
It takes a bit of experimentation to work out sometimes. Doing a search on the hook name in the EE files will give you an idea of where a hook specificly occurs as well. Sometimes that will help in figuring out your options and the way your method should respond once it’s done.
Jamie
Great, thanks Jamie.
I think I’ve got a basic grasp of things now. My only remaining question for the moment is whether the following assumptions are correct:
The bottom-line of what I want to do is to insert a bunch of code right smack in the middle of the template edit form - probably floated off to the side of the big textarea where the editing gets done, which means it would need to come immediately before the textarea tag in the HTML source. I’ve got the impression that the edit_template_start hook, since it doesn’t return any data, would insert anything I gave it far too early in the HTML, correct? So that leaves me with the edit_template_end hook. Since it does return data, would I be correct in assuming that it could give me the entire code of the template editing form to play with, and that I’d need to search through that code for the textarea tag, insert my code immediately before it, and then return the modified template editing form code?
The potential of this extension - if it works - is exciting. I’d always appreciated the fact in Textpattern that you had a dynamic reference to the various tags you could use in a template right there next to the editing field. It made the learning curve much easier. I think this extension could theoretically be expanded to similarly encompass every tag available here, although it would be a butt-load of work to maintain if it can’t pull a tag listing from the database dynamically.