UBB.Dev
Posted By: omegatron Classifieds IIP Pal Version 1.0 - 02/06/2005 5:03 PM
Okay someone asked for it so here is a Photopost Classifieds Pal for IIP to display your Photopost classifieds ads on IIP for UBBThreads.

Attached File
125161-classifiedspal.zip  (279 downloads)
Posted By: TheInsider Re: Classifieds IIP Pal Version 1.0 - 05/15/2005 12:36 AM
Hey Chuck I'm getting this error:

Featured Ads
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/iraqiins/public_html/ubbthreads/pals/custombox2pal.php on line 54

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/iraqiins/public_html/ubbthreads/pals/custombox2pal.php on line 77


I've been playing with it but can't seem to get it right.

Any idea?
Posted By: AllenAyres Re: Classifieds IIP Pal Version 1.0 - 05/19/2005 1:50 AM
Is your path set at the top correct?
Posted By: TheInsider Re: Classifieds IIP Pal Version 1.0 - 05/20/2005 1:47 AM
Yeah... I have this as my path:
require ("/home/iraqiins/public_html/ubbthreads/classifieds.inc.php");

The error lists line 54 and 77 as the problem.

This is line 54:
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

This is line 77:
mysql_free_result($result);

I'm not getting "can't connect" type errors so I think it's connecting to the database. I am using the PhotoPal add-in and it works fine. I've compared them both and can't see why this won't work either.
Posted By: AllenAyres Re: Classifieds IIP Pal Version 1.0 - 05/20/2005 11:06 PM
hmm... did you set the path at the bottom of the custompal code to your threads? And you might re-check all those settings in the classifieds.inc.php file, there's a lot of them
Posted By: Basil Fawlty Re: Classifieds IIP Pal Version 1.0 - 04/03/2010 5:41 PM
I am trying to get this custom pal for classifieds to work and have now come to my wits end. I downloaded the custom pal from this thread and made modifications to the paths in the custom pal script and the classifieds.inc.php file. When I try to display the box, the box shows up, but is empty (Basically just the title of the box appears).

Here is what my custom pal script looks like (with some stuff changed for security reasons of course):

PHP Code


<?

require ("/home/xxx/public_html/forum/classifieds.inc.php");

function
clget_ext( $filename ) {
return
substr($filename, strrpos($filename,"."));
}

function
clis_image( $filename ) {
$retval = 0;

$mediatypes = array( ".jpg", ".gif", ".png" );
$ext = clget_ext( $filename );

if (
in_array(strtolower($ext), $mediatypes) )
$retval = 1;

return(
$retval );
}

//
// Featured Products Code
// Follow down to End Feature Products Code
//

// which type of images do you want to show
$q_switch = "random";

switch (
$q_switch) {
case
"most_view":
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM cp_products WHERE bigimage != '' ORDER BY views DESC";
break;
case
"lastest":
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM cp_products WHERE bigimage != '' ORDER BY date DESC";
break;
case
"random":
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM cp_products WHERE bigimage != '' ORDER BY RAND()";
break;
}
$result = mysql_query($query);

echo <<<UBBTPRINT
$tbopen
<tr>
<td class="tdheader" colspan="5" align="center">
Featured Ads
</td>
</tr>

UBBTPRINT;
$counted = 0;
while (
$line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$product = $line["bigimage"];
$title = $line["title"];

$title = ( strlen($title) > 20 ? substr($title,0,20)."..." : $title );

if (
clis_image($product) ) {
$productlen = strlen($product);
$theext = clget_ext($product);
$product_name = str_replace( $theext, "", $product );

print
"<tr><td align="center" class="lighttable" width="20%"><font size="1" face="verdana,arial">";
$temp_user = $line["userid"];

$thumbtag = "{$full_path}{$line['cat']}/{$line['userid']}{$product}";
$mthumb = "<img border="0" src="{$cldata_dir}{$line['cat']}/{$line['userid']}{$product_name}-thumb{$theext}" alt="$thumbtag" />";

print
"<a href="{$clurl_path}/showproduct.php?product={$line['id']}">$mthumb</a><br />{$title}</font></td></tr>";
$counted++;
}

if (
$counted == 5 ) break;
}
mysql_free_result($result);

echo <<<UBBTPRINT
$tbclose
<br />
UBBTPRINT;

//IF YOUR THREADS DATABASE IS DIFFERENT THEN CLASSIFIEDS THEN UNCOMMENT THIS LINE AND PLACE YOUR DATABASE NAME BELOW FOR THREADS
mysql_select_db('xxx_threadsv7') or die("Could not select database 'database'\n");

?>



Then this is my classifieds.inc.php:

PHP Code



<?
//You must change these values in order to run this script


$clurl_path = "http://www.mysite.com/classifieds/"; //URL of your photopost installation is, where the index.php is (with / at end)
$cldata_dir = "http://www.mysite.com/classifieds/data/"; //URL of your photo dir where those jpeg stored (with / at end)

// configure your database settings
$clhost = "localhost"; //Server Name
$cluser = "myusername";; //Username
$clpassword = "mypassword"; //Password
$cldatabase = "xxx_ppclassifieds"; //Reviewpost database name or forum database name

//Your reviewpost table prefix enter it below
$Globals['cl_db_prefix'] = "cp_";

// Connecting, selecting database
$cllink = mysql_connect ("$clhost", "$cluser", "$clpassword") or die ('I cannot connect to the database.');
mysql_select_db ("$cldatabase")or die("Could not select database");
?>



I do not get any errors, but nothing gets displayed in the portal box.


One thing I was wondering about - if you open a new blank custom portal in Admin, you see this:

PHP Code

/* PHP CODE HERE, IF NECESSARY */

/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF

Body of the custom box here

EOF;
/* DO NOT CHANGE THE LINE ABOVE */




Does this need to be in the custom pal script for this classifieds mod to work? The sample custom pal I downloaded from this thread does NOT have this code in it, but should it be there? If so, where in relation to the rest of the code?

Any help would be greatly appreciated.
Posted By: Gizmo Re: Classifieds IIP Pal Version 1.0 - 04/03/2010 8:30 PM
Well, a huge problem is probably going to be that this was written for v6 and you're running v7... The code differences from both versions are basically two totally different products...
Posted By: Basil Fawlty Re: Classifieds IIP Pal Version 1.0 - 04/04/2010 1:32 AM
The only thing about that is, I am using (or had been until recently) the Photopost photos pal mod and it was working fine. Nears as I could tell they were very similar. Which then begs the question - is there a Custom Pal for the PhotoPost Classifieds that will allow me to have "recent" ads display in a PAL on my forums?
© UBB.Developers