Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
Originally Posted by Cuervo
Has anyone got this working with 7.1 and PP 5.62

I have it working with 7.1 and PP 5.62 (integrated). I will try to provide as must information as possible. First, I am using Imagemagik instead of GD in my PP. I don't know if that makes any difference, but thought I'd mention it. Ok, here is exactly, in total, what I have in my Custom PAL (I've just changed some minor things for security reasons, but you will want to put your paths and database names in anyway):

PHP Code

/* PHP CODE HERE */
// This script should pull 5 random pictures from
// PhotoPost and display it.
// Please modify the two lines with the databse
// connection to your settings.
//
// The base idea for this script comes from Chuck S. */

// Set it up to your path settings !
require_once("/home/mysite/public_html/forums/photopost/inc_photopost.php");

// Set this to your PhotoPost db prefix. Default is pp_
$pp_db_prefix = "pp_";

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

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

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

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

return(
$retval );
}

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

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

switch (
$q_switch) {
case
"most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM
{$pp_db_prefix}photos p
LEFT JOIN
{$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC"
;
break;
case
"lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM
{$pp_db_prefix}photos p
LEFT JOIN
{$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC"
;
break;
case
"random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM
{$pp_db_prefix}photos p
LEFT JOIN
{$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()"
;
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ( list(
$pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if (
pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border="0" src="{$data_dir}{$pcat}/thumbs/{$photo}" alt="$thumbtag" />";

// One box for each feature
$featured .= <<<PPPRINT

<tr align="center"><td align="center" class="alt-1">
<a href="
{$url_path}/showphoto.php?photo={$pid}">$mthumb</a><br>
by
{$puser}
</td></tr>

PPPRINT;

$counted++;
}

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

// change the dbname to your ubb7 database name
// we need to switch back to Threads7 database
//MAKE SURE TO USE YOUR CORRECT THREADS 7.1 DB NAME!
mysql_select_db ("threads")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT;


Notice that I am pointing to inc_photopost.php in the "Require_Once" statement above. This is a file that now comes with PP 5.62.

Within the file inc_photopost.php you will want to uncomment the database lines near the top of the file like this:

PHP Code

$link
= mysql_connect ("localhost", "usernam", "password") or die('I cannot connect to the database.');
mysql_select_db ("photopost")or die("Could not select photopost database");



Be sure to edit to reflect YOUR user name and password for the PP database. Also, make sure the "photopost" database name is what you are using in the mysql_select_db statement.

Not also, you can change this line:

// which type of images do you want to show
$q_switch = "lastest"; (Yes, I know it is mispelled)

you can replace "lastest" with "random" or "most_view" depending on what category of images you want to pull from the PP database.

I hope this helps. It works fine for me,

Basil





Sponsored Links
Entire Thread
Subject Posted By Posted
[7.0] [Beta] PhotoPost featured photos pal Zarzal 07/30/2006 10:36 AM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 07/31/2006 6:11 PM
Re: Beta [7.0] PhotoPost featured photos pal Zarzal 07/31/2006 10:48 PM
Re: Beta [7.0] PhotoPost featured photos pal StanCA 08/05/2006 9:09 PM
Re: Beta [7.0] PhotoPost featured photos pal Zarzal 08/06/2006 12:20 AM
Re: Beta [7.0] PhotoPost featured photos pal StanCA 10/07/2006 8:27 PM
Re: Beta [7.0] PhotoPost featured photos pal StanCA 10/07/2006 8:27 PM
Re: Beta [7.0] PhotoPost featured photos pal StanCA 10/07/2006 8:28 PM
Re: Beta [7.0] PhotoPost featured photos pal Zarzal 10/10/2006 12:57 AM
Re: Beta [7.0] PhotoPost featured photos pal StanCA 10/10/2006 10:46 PM
Re: Beta [7.0] PhotoPost featured photos pal Micky 10/10/2006 11:27 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 12/31/2006 9:28 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 12/31/2006 9:40 PM
Re: Beta [7.0] PhotoPost featured photos pal Zarzal 01/01/2007 5:44 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 01/02/2007 8:25 AM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 01/02/2007 10:01 AM
Re: Beta [7.0] PhotoPost featured photos pal Z65_Paul 01/02/2007 10:47 AM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 01/02/2007 4:38 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 02/25/2007 7:44 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 02/25/2007 10:37 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 02/26/2007 9:50 AM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 02/26/2007 4:45 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 02/26/2007 4:58 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 02/26/2007 5:25 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 02/26/2007 5:27 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 02/26/2007 5:32 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 02/26/2007 5:41 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 02/27/2007 4:51 AM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 11:31 AM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 2:32 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 5:57 PM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 6:16 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 6:42 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 03/03/2007 6:47 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 6:54 PM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 8:04 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 9:07 PM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 9:48 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 9:59 PM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 10:14 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 10:21 PM
Re: Beta [7.0] PhotoPost featured photos pal Cuervo 03/03/2007 11:25 PM
Re: Beta [7.0] PhotoPost featured photos pal Basil Fawlty 03/03/2007 11:45 PM
Re: Beta [7.0] PhotoPost featured photos pal AllenAyres 09/24/2007 5:53 AM
Re: [7.0] [Beta] PhotoPost featured photos pal Cuervo 03/04/2007 4:42 PM
Re: [7.0] [Beta] PhotoPost featured photos pal ADWOFF 03/08/2007 9:49 AM
Re: [7.0] [Beta] PhotoPost featured photos pal Cuervo 03/08/2007 9:59 AM
Re: [7.0] [Beta] PhotoPost featured photos pal Zarzal 07/24/2007 7:54 PM
Re: [7.0] [Beta] PhotoPost featured photos pal AllenAyres 07/26/2007 5:45 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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
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)