Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-12-22 02:27:03

Maleika E.A.
Member
From: Hamburg, Germany
Registered: 2004-12-11
Posts: 39
Website

Creating a Plugin to retrive Data from MySQL DB?

Hi

I would like to create a plugin for my site that automatically retrieves data from my DB.

Here is a sample scenario.

I am making a huge monster list of live concerts archives.
Each entry should look the same.

Each entry would look like this when outputted from the DB:

Date of concert: xxxx

Venue: xxxx

Location: xxxx

Setlist:

1.xxx

2.xxx

3.xxx

4.xxx

and so on …

Notes: xxx

Source: xxx

Source2: xxx

User Comments (n)

User Ratings (n) this entry has n votes

I assume I could use the built-in comments for and the rating plugin for the latter two.

But for the other data I mentioned, I assume I’d be best served with creating a custom plugin to work with TXP.

Do any of you have some tips for a newbie? Any resources which you fellow TXP fans have used or are using for creating plugins for TXP?

I assume I would have to create database relations and the like and then find a way to output the entry somehow.

If you have any tips for me, that would be wonderful. :)

Thank you a ton.

Maleika

Offline

#2 2004-12-22 22:11:13

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

Re: Creating a Plugin to retrive Data from MySQL DB?

if you really need to do it this way (I think doing it as a plugin is kinda backwards… you might be served better by a separate php file), you can just start off by copying doArticle(), and modifying the mysql query at the beginning, then sending your variables to $thisarticle. That way you can use article forms to display the content.

Offline

#3 2004-12-23 13:24:24

Maleika E.A.
Member
From: Hamburg, Germany
Registered: 2004-12-11
Posts: 39
Website

Re: Creating a Plugin to retrive Data from MySQL DB?

Ah, I understand.

What would be a better way if I may ask? I have no clue how to approach this issue optimally. So, if you have thoughts on how you’d feel would be a smarter approach, that’d be great. :)

Thanks in advance,

Maleika

Offline

Board footer

Powered by FluxBB