Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Okay someone asked for it so here is a Photopost Classifieds Pal for IIP to display your Photopost classifieds ads on IIP for UBBThreads.
Attachments
125161-classifiedspal.zip (0 Bytes, 279 downloads)

Sponsored Links
Joined: Mar 2003
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2003
Posts: 118
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?

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Is your path set at the top correct?


- Allen wavey
- What Drives You?
Joined: Mar 2003
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2003
Posts: 118
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.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
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.

Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
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...


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
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?

Last edited by Basil Fawlty; 04/03/2010 6:34 PM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)