Textpattern CMS support forum
Re: Function location.
What wet said. If you are still interested in doing your own stuff, you can easily do this with a plugin. Textbook has an introduction in pugins, and links to a couple of tutorials. There is also a sticky in the plugin forum. The included examples should get you going.