I've been using Michael De La Rue's Classifads script to provide classified ads on one of my sites for some time now. Then I thought that this would also make a nice plugin for Geeklog. So I hacked on it long enough until in gave up and integrated nicely into Geeklog.
Please note that this is my first plugin and the integration is not as complete yet, as one might wish. Let me know what you think about it.
The feature list of this plugin is almost identical to the original script by Michael De La Rue:
Additional features, specific to the Geeklog plugin:
Download here (21 K
bye, Dirk
Okay, the first issues have come up (thanks to toad for the quick feedback). It seems my version of PHP is a bit more fault-tolerant than others ...
If you get "undeclared function" errors, check public_html/index.php
and public_html/updata.php
and remove the dollar signs from these lines:
echo $COM_endBlock();
echo $COM_siteFooter();
While you're at it, add the following line in public_html/index.php
:
$i = "0";
$posti = array (); // this is the line to add
while($ad = mysql_fetch_assoc($query)) {
(that's lines 57-59).
Of course, you could instead just download the updated tarball from the URL provided in the original story.
Sorry about that.
bye, Dirk
Sounds like a good idea. We have these hints in Geeklog whenever you can enter a URL, so we should have them in the plugins, too. I will add this in the next release of the plugin.
BTW, you might want to add this in updata.php, too.
bye, Dirk
Thanks, squatty. That will make a nice addition to the plugin and make it integrate further into Geeklog. It should be relatively easy to pull the necessary code from public_html/index.php
. Let me know how you get on with it.
bye, Dirk
I created a separate php file named display_ads.php. You can view the source code here. Note, the select statement will ONLY display ads submitted within the last 48 hours (at least that's what it's supposed to do
To deploy the block, complete the following:
Download the display_adds.php and save it to your /public_html/classifads directory Add the following to lib-custom.php:
function phpblock_classifieds()
{
global $_CONF;
$path = $_CONF['path_html'] . "classifads";
include_once($path . "/display_ads.php");
$display = getads();
return $display;
}
You will also notice that I added two links at the bottom of the block. The submit link goes to an additional page I created. I removed the submit logic from the original index.php. This was just a preference of mine. You can see my version of the plug-in at http://www.squatty.com.
Thanks,
Squatty
Thanks, squatty! I had to hack it a bit to get it working, though. But it sure is as nice addition to the plugin, so I will add something like this to the next version of the plugin. I also borrowed your "Fields in bold are required" line, if you don't mind ;-)
bye, Dirk