Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-11-29 18:57:49

edburdo
Member
Registered: 2004-09-20
Posts: 79
Website

My First Plugin - Some questions

Ok, I am trying to create my own plugin. I have several I want to build…

I am using the template from Zem (thankx Zem). Is there are tutorial out there, or is this basically a “hack around until it works” sort of deal?

And would anyone offer up their full source of a simple plugin to look at?


Eric

Offline

#2 2004-11-29 19:14:28

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: My First Plugin - Some questions

Well, you can get the full source from any plugin you like. When you click on the name in TXP, you can see the full source.

But a few pointers.

  1. It’s worthwhile to poke through ./textpattern/publish.php and ./textpattern/publish/taghandlers.php as these are the basic ones. You can see a lot of examples of the various database accessing functions.
  2. Set up a sandbox page to play with. If your site needs to have 100% availability, create a different site for sandboxing. It’s possible to crash ANY page render with a plugin.
  3. If you are on a local site and you can edit your textpattern install, it can be helpful to include your plugin at the end of taghandlers.php. This way you can test and revise without going through the hassle of doing the whole plugin creation thing.
  4. Test Test Test Test Test
  5. If you do have to test with the plugin uploaded to a TXP page, notice you can modify the source code. print_r is your friend here. You can put in a lot of notify-points and data prints and see what your plugin is seeing.
  6. It’s worthwhile to suss out the contents of $pretext. It has a lot of good information in it.
  7. thisarticle data is only available when your plugin is part of an article form.
  8. … and more… maybe it would be good to start a list of plugin creation tips?

Offline

#3 2004-11-29 20:00:43

edburdo
Member
Registered: 2004-09-20
Posts: 79
Website

Re: My First Plugin - Some questions

I have a sandbox to play in… So that isn’t a problem. I periodically blast it and redo it, so I can always havea fresh database to tinker with. :)

I will check out the publish and taghandlers files… thanx for the tips.

And I plan on writing up some of my findings to publish online… so as long as I stick with the project, some of that information will be showing up soon. :)


Eric

Offline

#4 2004-12-01 00:01:53

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: My First Plugin - Some questions

Oh, and comment the hell out of everything. Inevitably, someone 6 months down the line will come up with a feature request that’s reasonable and you don’t want to have to remind yourself any more than is necessary what you were thinking at the time :).

Offline

Board footer

Powered by FluxBB