The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to get info from database?
First let me explain, I have my main home page as a non-vbulletin, though I create those pages based vb templates with a guide posted here somewhere.
Now, I gave one of my members a Journalist job and he needs to be able to edit some news on that main page. I don't want to give him admincp access. What I have done is made him a page to insert news in a form that inserts into the database. Now, I would like to know how I can retrieve that data for it to show on the main page. I tried a database query, but get errors for a bad template. I tried to create a plugin (first time), but was unsuccessful. Can someone guide me to how to do this? Thanks, T. |
#2
|
||||
|
||||
This makes no sense. Please explain. How does retrieving data cause a template error...what is a template error...and what error is it you are getting.
|
#3
|
|||
|
|||
When I put the code to query info in the database in a template I get this template error:
Quote:
And here's part of the query code: PHP Code:
|
#4
|
||||
|
||||
Because you can't place PHP code in a template. It must be executed in a plugin or in the file itself. You should also use the vB $db class for all your queries -- there's an article in the Articles forum that describes the process.
|
#5
|
|||
|
|||
Where is this articles forum?
|
#6
|
||||
|
||||
Here's the article: https://vborg.vbsupport.ru/showthread.php?t=119350
|
#7
|
|||
|
|||
Nice thank you.
Is there an article on how to create plugins for retrieving data? I managed to create a plugin with this code: PHP Code:
Quote:
|
#8
|
|||
|
|||
You need something like
PHP Code:
|
#9
|
|||
|
|||
Thanks, it's working correctly now.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|