Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Quering the db in a plugin
For a plugin that I’m writing for my school newspaper’s website (which is powered by txp) I’m planning on querying the database, because of certain problems in the way that txp handles lists of articles. Should I just use the mysql functions in php, or is there a better way to do this in a plugin? When textpattern encounters a plugin, does it just parse the php, or does it put restrictions on what is in there? Some help would be greatly appreciated.
Offline
#2 2005-02-09 01:17:21
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Quering the db in a plugin
> For a plugin that I’m writing for my school newspaper’s website (which is powered by txp) I’m planning on querying the database, because of certain problems in the way that txp handles lists of articles.
What problems?
> Should I just use the mysql functions in php, or is there a better way to do this in a plugin? When textpattern encounters a plugin, does it just parse the php, or does it put restrictions on what is in there? Some help would be greatly appreciated.
Use the safe_* functions provided by Textpattern. Take a look at the txp code for examples, particularly taghandlers.php.
You can do pretty much anything in a plugin.
Alex
Offline
Re: Quering the db in a plugin
Thanks for the (ridicolously) fast response. The problem is that I have a page where I want to list multiple categories of stories. The page is linked to a specific category, and if I use an article_custom tag, the listing is put on all of the pages of articles in that category (i.e. even when it’s a single page).
EDIT: An example of what I mean can be found at <a href=“http://www.cruzilla.com/newspaper/opinion/?c=Current”>www.cruzilla.com/newspaper/opinion/?c=Current<a/>.
Last edited by wyldeone (2005-02-09 01:27:54)
Offline
#4 2005-02-09 01:44:33
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Quering the db in a plugin
Why not just list everything in the section? -
http://www.cruzilla.com/newspaper/opinion/
Alex
Offline
#5 2005-02-09 02:19:24
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Quering the db in a plugin
Okay, so what’s the problem? Or there isn’t one now?
Offline
Pages: 1