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 1 of 2 1 2 >
Topic Options
#1414 - 07/19/06 12:48 PM [FIXED in b2] Problem with custom Portal boxes
d-talk Offline
journeyman
Registered: 06/06/06
Posts: 95
Loc: Germany
I took some html code at my custom portal box and get the following error:

Parse error: syntax error, unexpected '<' in /var/www/web10/html/cache_builders/custom/portal_box_1.php on line 2


Edited by Rick (07/20/06 03:21 PM)
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."
#1415 - 07/19/06 12:53 PM Re: Problem with custom Portal boxes [Re: d-talk]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
Loc: Aberdeen, WA
Can you open up your cache_builder/custom/portal_box_1.php file and paste the contents in here?
Top
#1416 - 07/19/06 12:55 PM Re: Problem with custom Portal boxes [Re: Rick]
d-talk Offline
journeyman
Registered: 06/06/06
Posts: 95
Loc: Germany
Php Code:

<?php
<a href="http://www.ubbcentral.com">UBBCentral Webseite</a>

<br>

<a href="http://www.ubbcentral.com/order.php?product=UBB.threads">Preise / Bestellen</a>

<br>

<a href="http://www.infopop.com/members/members.php">UBB-Central Members Area</a>
?> 
Top
#1417 - 07/19/06 01:00 PM Re: Problem with custom Portal boxes [Re: d-talk]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
Loc: Aberdeen, WA
Ok, the custom islands are going to be the hardest thing for people to get used to I think. These are just blocks of php code, so it will take a bit of knowledge with PHP in order for these to work properly. If you wanted that exact same bit you would put this into the custom island editor

Php Code:

$body = <<<EOF
<a href="http://www.ubbcentral.com">UBBCentral Webseite</a>
<br>
<a href="http://www.ubbcentral.com/order.php?product=UBB.threads">Preise / Bestellen</a>
<br>
<a href="http://www.infopop.com/members/members.php">UBB-Central Members Area</a>
EOF;
 
Top
#1423 - 07/19/06 01:34 PM Re: Problem with custom Portal boxes [Re: Rick]
d-talk Offline
journeyman
Registered: 06/06/06
Posts: 95
Loc: Germany
ahhh... thank you Rick, it works now cool
Top
#1490 - 07/20/06 03:54 AM Re: Problem with custom Portal boxes [Re: Rick]
Zarzal Offline
old hand
Registered: 06/05/06
Posts: 1142
Loc: Berlin, Germany
I try to convert a old pal box from threads6 IIP to UBB7 but encounter some trouble. The Box should pull pictures from my PhotoPost gallery and look like this:

Php Code:

require_once("/home/.../photopost.inc.php");
$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);


echo <<<PPPRINT
$tbopen
<tr>
<td class="tdheader" colspan="5" align="center">
Featured Photos
</td>
</tr>
$featured
$tbclose<br />
PPPRINT;

mysql_select_db ("name of uub7 database")or die("Could not select database");
 


This script generate the output itself and I don't know how to split it to a php part and a output part. While playing with it I get some results but not as it should. The main problem seems to me, that I hafe to switch back to the ubb7 database after I do the selects from the photo database. This doesn't work as it should.
Can you try to explain how this works in ubb7 as example for complex pal boxes?
_________________________
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
#1513 - 07/20/06 11:45 AM Re: Problem with custom Portal boxes [Re: Zarzal]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
Loc: Aberdeen, WA
The first problem I see is at the bottom. This portion:

Php Code:

echo <<<PPPRINT
$tbopen
<tr>
<td class="tdheader" colspan="5" align="center">
Featured Photos
</td>
</tr>
$featured
$tbclose<br />
PPPRINT;
 


That should be:

Php Code:

$body = <<<PPPRINT
$tbopen
<tr>
<td class="tdheader" colspan="5" align="center">
Featured Photos
</td>
</tr>
$featured
$tbclose<br />
PPPRINT;
 


Anything that is going to be actually displayed in the portal box needs to be stored in the $body variable. If there are errors beyond that, I'll look more today.
Top
#1517 - 07/20/06 12:04 PM Re: Problem with custom Portal boxes [Re: Rick]
Zarzal Offline
old hand
Registered: 06/05/06
Posts: 1142
Loc: Berlin, Germany
thanks, but this seems to be a little bit beyond my abilities. I get:
Fatal error: Cannot redeclare pp_get_ext() (previously declared in /home/.../ubb7/cache_builders/custom/portal_box_4.php:7) in /home/.../ubb7/cache_builders/custom/portal_box_4.php on line 9

There must be more to do to bring this to work.
_________________________
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
#1521 - 07/20/06 12:41 PM Re: Problem with custom Portal boxes [Re: Zarzal]
Rick Offline
Post-a-holic
Registered: 06/04/06
Posts: 10164
Loc: Aberdeen, WA
Ok, there is a bug that is rebuilding the cache twice and it's redeclaring your functions. Here's the fix.

Edit admin/doeditcustomisland.php

Remove line 125 which is this:

rebuild_islands(1);
Top
#1533 - 07/20/06 02:25 PM Re: Problem with custom Portal boxes [Re: Rick]
Zarzal Offline
old hand
Registered: 06/05/06
Posts: 1142
Loc: Berlin, Germany
very well, it beginn to work. Great. Now I go to finish the layout. One step closer. When its done I post the whole code.
_________________________
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
#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
#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 1 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