PDA

View Full Version : Display results from Plugin


Jaiibee
04-10-2009, 09:58 AM
Ok, so I have made my own plugin called "Custom Classifieds Listing", with a name of "Automated Classifieds Listings"

$sql = mysql_query('SELECT * FROM vb_classifieds_ads WHERE categoryid = 1');

while ($row = mysql_fetch_array($sql))
{
echo $row['title'];
}





That's what I've got. It display the only entry that's in that table, however it displays it at the top of the page before the header.

Ok, so basically, I want to know how to position this output in my templates.
I want to be able to say "$post[ccl_posthing]" and the results from that MySQL query is displayed.

I know this is very basic, and most likely covered where I haven't already looked, but any help would be greatly appreciated.
Thanks.

Lynne
04-10-2009, 02:34 PM
Try:
$post['ccl_posthing'] .= $row['title'];

Jaiibee
04-11-2009, 02:32 AM
So that goes into the plugin, and whenever I type $post['ccl_posthing'] in a template, it'll output the value retreived form $row['title'] ?

Lynne
04-11-2009, 02:35 AM
That line would replace your echo line in your plugin. It should work in your template assuming you are using the correct plugin and your code is correct. Try it on your test site and see.