Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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