PDA

View Full Version : Photopost Classifieds in a Widget


roymogg
03-10-2010, 05:07 PM
I have been trying to get the latest photopost classifieds direct php working:

I am using the following code from over there at PC:


$host = 'localhost';
$dbUser = 'example';
$dbPass = 'password';
$db = 'forum';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());
ob_start();
$result = mysql_query("SELECT id,cat,bigimage FROM cp_products WHERE bigimage != '' order by rand() LIMIT 2" ) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print"<center>";
print "<a href=\"http://www.example.com/classifieds/showproduct.php?product=" . $row['id'] . "&cat=" . $row['cat'] . "\"><img src=\"http://www.example.com/classifieds/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\" border=\"0\"></a>";
print "</center>";
}
$output .= ob_get_contents();
ob_end_clean();


I put this into a widget or forum block and module renders but no content and I cannot see a problem.

EDIT: There was a slip in the path to the image - the above code works fine

cheers

Roy

Marco van Herwaarden
03-11-2010, 09:32 AM
You should ask this at the vBAdvanced website, assuming you are asking it to be included on a vBA page.

roymogg
03-11-2010, 09:49 AM
Marco,

I have posted this question in the wrong forum - I have VB4 and want to run this code in a CMS and a blocks widget (I do not have VBA anymore)

can this thread be moved to the correct forum please?

cheers

roymogg

Marco van Herwaarden
03-11-2010, 02:22 PM
In that case, moved. ;)

Videx
03-11-2010, 09:47 PM
I've got that same code all ready to go, just haven't had the time for it. Sorry to hear it's not working. I'd also like a forum block, but have no idea how those relate to widget code.

roymogg
03-21-2010, 05:36 PM
Hi Marco,

I have the photopost classifieds php direct execution widget working fine as a CMS widget but I have copied the code into a forum blocks php widget and the block shows up but the ads do not render.

Is there any difference between the way CMS widgets work and the forum blocks equivalent?

What is the significance of the cache time in forum-block widgets?

regards

Roy