Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2006
Posts: 3,837
I
Ian
Offline
Carpal Tunnel
Carpal Tunnel
I Offline
Joined: Jun 2006
Posts: 3,837
Hi,

Just wondered if anyone here was running either photopost or photopost classifieds with threads?

Have you managed to integrate the sidebars with the product? if so how?

Thanks.

Joined: Apr 2006
Posts: 144
Member
Member
Joined: Apr 2006
Posts: 144
I've got a random image sidebar operating on My Site. I'm still running Photopost Ver 5.62. Haven't yet upgraded to V6.x. Here's the custom island code I used:

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/user/public_html/photopost/photopost.inc.php");

// Set this to your PhotoPost db prefix
$pp_db_prefix = "prefix_";

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 (most_view, latest, random)
$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 "latest":
$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 = '' AND p.cat NOT IN (555,511,512,513,514,515,516,517,518,520,526)

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);


/* DO NOT CHANGE THE LINE BELOW */

$body = <<<PPPRINT

$featured

PPPRINT;

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

I have it set up to only show Random pictures from certain photopost galleries... so you'll see a large string of excluded gallery numbers in the code.

Hope this helps.
Paul


Stress the system until it breaks. Hey.. it works for Spacecraft.. why not here?

UBB since 1999: MonteCarloSS.com
Joined: Jun 2006
Posts: 3,837
I
Ian
Offline
Carpal Tunnel
Carpal Tunnel
I Offline
Joined: Jun 2006
Posts: 3,837
Sorry what I meant was to display the left and right sidebars of threads within photopost or classifieds.


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Havenofsobriety), 458 guests, and 91 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)