Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2008-05-19 22:51:56
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
Ok, I think might have gotten together my coding but what is next? How do I make it into a plugin and so on?
<txp:Ruhh />
Offline
Re: must have hack?
Anatomy of a plugin and Plugin development. See the section on register_callbacks – you want to use the “form” event (?event=form in the address bar).
Offline
#18 2008-05-19 23:29:27
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
Sighs, I’ll try to find some time to read over the “anatomy of a plugin”.
I don’t quite understand it. Where do I go to decode the PHP code? Anybody clarify me and provide steps?
Last edited by Ruhh (2008-05-19 23:48:47)
<txp:Ruhh />
Offline
#19 2008-05-19 23:54:01
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
Oh, how would I go about getting the plugin to have an access to the database without having an user type in the database information?
<txp:Ruhh />
Offline
Re: must have hack?
Your plugin already has access to the db since it’s tied into TXP. You can use any and all of TXP’s db functions. Those are found in textpattern > lib > txplib_db.php. You might want to poke around the TXP code at PHPXref.com. It’s very helpful and has quick access to everything used to make TXP run.
Offline
#21 2008-05-20 01:11:13
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: must have hack?
ied_plugin_composer my favorite development tool, I’m not sure I could get along without it anymore.
Offline
#22 2008-05-20 01:34:32
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
i have been there. the download link does not work.
<txp:Ruhh />
Offline
Re: must have hack?
Ruhh wrote:
Oh, how would I go about getting the plugin to have an access to the database without having an user type in the database information?
Check out textpattern/lib/txplib_db.php.
Testing your plugin is really simple – load it from the plugin cache. If you load it from the plugin cache, you don’t need to compile it until you’re ready to distribute1. Skim the Threshold State articles – it’ll make sense soon.
1 If your plugin includes zem_tpl.php, it’ll be compiled anytime someone directly accesses it from a browser (not from txpinterface).
Last edited by jm (2008-05-20 01:41:45)
Offline
Re: must have hack?
Forum topic for ied_plugin_composer. Functioning link download link here.
Offline
#25 2008-05-20 01:40:29
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
Ohh, neato. So say I have this part in my code:
$link = mysql_connect("host", "user", "pass") or die("Can't connect.");
mysql_select_db("txp_form", $link) or die("Can't select database.");
I just take that out? And the rest be kept.
<txp:Ruhh />
Offline
Re: must have hack?
Yep. If Textpattern can connect to the db (which it can since you’re using it) your plugin is connected to the db. Just use the functions within txplib_db.php.
Offline
Re: must have hack?
Yep – just use the database functions (safe_*). BTW, txp_form is a table not a database :).
Edit: Man, I am slow today!
Last edited by jm (2008-05-20 01:43:31)
Offline
Re: must have hack?
Hah! JM, I beat you by 14 seconds though your response is a bit more informative ;)
Offline
#29 2008-05-20 01:48:31
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
Right, doh! I was just making a quick code. I gotta go through it and proofread.
<txp:Ruhh />
Offline
#30 2008-05-20 02:01:10
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: must have hack?
Uh, I’m confused. I have no idea where to go first in the Plugin Composer tab in order to create a plugin?
Sorry to bother with questions. I’m just new to this thing. o.O
<txp:Ruhh />
Offline