Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
Here is everything I have in my custom portal box:

PHP Code

/* PHP CODE HERE, IF NECESSARY */
// 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/bcforum/includes/photopost.inc.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 = "random";

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>

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
mysql_select_db ("MyDBNAME IS HERE")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT;

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

Body of the custom box here

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



When I try to save it, I get unxepected $END at line...blah blah (see previos post).

Last edited by Basil Fawlty; 02/25/2007 3:38 PM.
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
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 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)