Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
1 registered (Telly), 24 Guests and 15 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 05/17/12
Posts: 3
Top Posters (30 Days)
Ruben 50
DennyP 24
Gizmo 24
Dunny 17
SteveS 14
AllenAyres 12
dbremer 10
SD 9
drkknght00 9
driv 8
Latest Photos
OK Corral Shoot Out
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Page 2 of 2 < 1 2
Topic Options
#1539 - 07/20/06 02:53 PM Re: Problem with custom Portal boxes [Re: Zarzal]
Zarzal Offline
old hand
Registered: 06/05/06
Posts: 1142
Loc: Berlin, Germany
Its done. If yo like, here the code for the PhotoPost Feature Box:

Php Code:

// 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("/your/path/to/photopost.inc.php");

// Set this to your PhotoPost db prefix
$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>
<br />by {$puser}
</td></tr>

PPPRINT;

$counted++;
}

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

// change the dbname to your ubb7 database name
mysql_select_db ("dbname")or die("Could not select database");

$body = <<<PPPRINT

$featured

PPPRINT;
 
_________________________
my board: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Top
Express Hosting
Express Hosting "We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
#2579 - 08/12/06 10:47 AM Re: Problem with custom Portal boxes [Re: Zarzal]
Stan Offline

old hand
Registered: 06/05/06
Posts: 708
Hmmm I get this error on my screen in the place on the foprum the photos should be.

any ideas??

Quote:
"; // One box for each feature $featured .= << $mthumb
by {$puser} PPPRINT; $counted++; } if ( $counted == 5 ) break; } mysql_free_result($result); // change the dbname to your ubb7 database name mysql_select_db ("db173191388")or die("Could not select database"); $body = <<
Top
#2581 - 08/12/06 10:53 AM Re: Problem with custom Portal boxes [Re: Stan]
Stan Offline

old hand
Registered: 06/05/06
Posts: 708
ALSO

I would think this code could work in 6.5 with a few mods? Would that be correct?
Top
#2583 - 08/12/06 11:15 AM Re: Problem with custom Portal boxes [Re: Stan]
Zarzal Offline
old hand
Registered: 06/05/06
Posts: 1142
Loc: Berlin, Germany
Do you change ALL settings in the script as neede? There are 2 places with comments who need to be changed to your settings. On top the DB settings for PP and somewhere down the DB settings for threads.
_________________________
my board: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Top
#2585 - 08/12/06 11:54 AM Re: Problem with custom Portal boxes [Re: Zarzal]
Stan Offline

old hand
Registered: 06/05/06
Posts: 708
I did change it, but as I reflect, and this is on my www.1and1.com server, I may have to put the beta version (7.0 beta3 ) in the same folder as my 6.5 forum, seems to me 1and1.com does not let anyone one view a mysql outside the main folder of a program.
Top
#2589 - 08/12/06 12:28 PM Re: Problem with custom Portal boxes [Re: Stan]
Zarzal Offline
old hand
Registered: 06/05/06
Posts: 1142
Loc: Berlin, Germany
This is possible. I have no restrictions on my server and run my testboard on a subdomain. This works for me. Its in both cases the same sql server but different databses. My testboard is closed but you can see the Featured Box runnig on the portal: http://www.dragon-clan.de/ubb7/ubbthreads.php

I m sorry that I have no more suggestions for you at this point. The script is quick and dirty done. It can be enhanced a little bit so all settings can be done on top.
_________________________
my board: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Top
Page 2 of 2 < 1 2



Moderator:  AllenAyres, Harold, Ian, Ron M 
Shout Box

Today's Birthdays
No Birthdays
Recent Topics
Ability to "like" individual posts (not Facebook "likes)
by doug
Today at 09:03 AM
Island Permissions
by ThreadsUser
Yesterday at 03:03 PM
streaming video
by prkrgrp
05/20/12 07:02 PM
New Posts Corrupted? Can someone help?
by PianoWorld
05/19/12 09:41 AM
Custom forum permissions
by ntdoc
05/18/12 02:07 PM
Forum Stats
10488 Members
36 Forums
33835 Topics
181687 Posts

Max Online: 978 @ 06/24/07 11:19 PM
Random Image