PDA

View Full Version : anyone tried todo a photopostpal with ipb?


b6gm6n
September 8th, 2004, 05:49 PM
Hi..

I'm trying, so far so good...not really

ipb...hmmm doesn't use $ in any templates right? thus if i insert a $photopostfeature or anything like that i'm stuffed... also i'm trying to find the string that holds the ipb.member['id'] - but i cannot use $ in ipb (i'm on v2.0 using 4.8.2) ahh...any help would be greatly recieved

edit, my databases are one, i'm trying to use the membergrouping to view thumbs or if not logged in show another thumb of my choosing, worked on VB... maybe i'll use the photopost group table instead

cheers

-T

dkmulford
September 9th, 2004, 10:07 AM
What are you trying to do? ...bring IPB into PP as a PAL? If so, I'd be interested in this also.

DM

b6gm6n
September 9th, 2004, 12:36 PM
no just the recent photos in the ipb index

-T

b6gm6n
September 9th, 2004, 01:32 PM
where's omegatron...? :)

i'm stuck, i get and invalid "mysql_fetch_array(): supplied argument is not a valid MySQL result resource"

gotta be right right?

I'm trying to make a photopost pal to show the recent images on my ipb index page, the query is good to my knowledge, i'm not sure if my 'mgroups' line is halting things, actually i removed it and still the same...please advise, i'll keep working :)


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

switch ($q_switch) {
case "latest":
$query = "SELECT id,user,userid,cat,title,bigimage,views FROM {$Globals['dprefix']}photos ORDER BY date DESC";
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$photo = $line["bigimage"];

if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line["userid"];

if (($mgroups['usergroupid'] == "2") || ($mgroups['usergroupid'] == "8") || ($mgroups['usergroupid'] == "1"))
{
$thumbtag = "";
$mthumb = "<table width=\"0\" border=\"0\" class=\"vbulletin_editor\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><a href=\"http://www.sgurl.org/forums/subscriptions.php\"><img border=\"0\" src=\"{$main_dir}subscribe.gif\" alt=\"subscribe today to view all\" /></a></td></tr></table>";
}
else
{
$thumbtag = "{$full_path}{$line['cat']}/{$line['userid']}{$photo}";
$mthumb = "<table width=\"0\" border=\"0\" class=\"vbulletin_editor\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><a href=\"{$url_path}/showphoto.php?photo={$line['id']}\"><img border=\"0\" src=\"{$data_dir}{$line['cat']}/{$line['userid']}{$photo_name}-thumb{$theext}\" alt=\"Uploaded by {$line['user']}\" /></a></td></tr></table>";
}
// One box for each feature
$featured .= <<<PPPRINT
<td align="center" bgcolor="#4C545F" width="20%"><table width="0" height="0" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center" valign="bottom">
<td colspan="3"><img src="border_01.gif" width="144" height="13" border="0" align="bottom"></td>
</tr>
<tr>
<td width="17" background="border_02.gif">&nbsp;</td>
<td width="111" height="0" align="center" bgcolor="#616B71">$mthumb</td>
<td width="16" background="border_04.gif">&nbsp;</td>
</tr>
<tr align="center" valign="top">
<td height="9" colspan="3"><img src="border_05.gif" width="144" height="13" border="0" align="top"></td>
</tr>
</table></td>
PPPRINT;
$counted++;
}

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

// First part is for the featured photos
// $photopostfeature not holds the Featured Photos box and $photopostcats (set below) holds the
// gallery list

$photopostfeature = <<<PPPRINT
<style type="text/css">
<!--
.style4 {
color: #D7D7D7;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
}
-->
</style>
<table class="tborder" cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td>
<table cellpadding="$stylevar[cellpadding]" cellspacing="1" border="0" width="100%">
<tr>
<td colspan="5" align="left" valign="middle" class="tcat">
<img src="../forums/images/hardwired/statusicon/user_online2.gif" border="0" align="absmiddle"> <span class="style4"><b>New Sgurl Pictures</b> : Last
Upload by {$line['user']}</span></td>
</tr>
<tr>
$featured
</tr>
</table>
</td>
</tr>
</table>
PPPRINT;

Tattooz
October 8th, 2004, 04:42 PM
Did anyone get this to work? I would really like to get some random photopost photos on my IPB 2.0 index page.

b6gm6n
October 8th, 2004, 06:42 PM
yeah i got it to work, check photopostdev.com :)

http://www.photopostdev.com/showthread.php?t=922

Tattooz
October 9th, 2004, 04:42 AM
I see that Toney, but I have mine setup in 2 seperate databases also.

Is there a fix for that?

Chuck S
October 9th, 2004, 07:18 AM
Yep Toney's problem was he was trying to define variables from ourside of photopost in IBP from looking at the code

If you need to use different databases just use the mysql select database

If they have the same user and password you can use this

mysql_select_db("db1");

If they have different user/password you need to setup a link statement and this


$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Not connected : ' . mysql_error());
}

// make foo the current db
$db_selected = mysql_select_db('foo', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}

Michael P
October 9th, 2004, 08:34 AM
http://www.photopostdev.com is the site we discuss subjects like this that involve coding issues. ;)

Tattooz
October 9th, 2004, 12:11 PM
omegatron, after trying what you said (mysql_select_db("db1");), I now get this error "Could not select photopost database"

Got any other ideas? Besides moving the database?

Thanks

Chuck S
October 9th, 2004, 12:43 PM
As Michael stated this kind of question is not answered on a support forum where we do not discuss hacking but help customers with the normal program

You need to ask your hacking questions at the hack site as I was just being nice and pointing you in the right direction

Tattooz
October 9th, 2004, 12:50 PM
Ok, will do, thanks