Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2006
Posts: 90
journeyman
journeyman
Joined: Jun 2006
Posts: 90
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

Last edited by Rick; 07/20/2006 3:21 PM.
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Can you open up your cache_builder/custom/portal_box_1.php file and paste the contents in here?

Joined: Jun 2006
Posts: 90
journeyman
journeyman
Joined: Jun 2006
Posts: 90
PHP Code

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

<br>

<a href="https://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>
?> 

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
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="https://www.ubbcentral.com">UBBCentral Webseite</a>
<br>
<a href="https://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;
 

Joined: Jun 2006
Posts: 90
journeyman
journeyman
Joined: Jun 2006
Posts: 90
ahhh... thank you Rick, it works now cool

Joined: Jun 2006
Posts: 956
Old Hand
Old Hand
Joined: Jun 2006
Posts: 956
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.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
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.

Joined: Jun 2006
Posts: 956
Old Hand
Old Hand
Joined: Jun 2006
Posts: 956
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.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
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);

Joined: Jun 2006
Posts: 956
Old Hand
Old Hand
Joined: Jun 2006
Posts: 956
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.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Joined: Jun 2006
Posts: 956
Old Hand
Old Hand
Joined: Jun 2006
Posts: 956
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.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Joined: Jun 2006
Posts: 869
old hand
old hand
Joined: Jun 2006
Posts: 869
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 = <<

Joined: Jun 2006
Posts: 869
old hand
old hand
Joined: Jun 2006
Posts: 869
ALSO

I would think this code could work in 6.5 with a few mods? Would that be correct?


http://clubadventist.com/forums

No longer following the carrot
Joined: Jun 2006
Posts: 956
Old Hand
Old Hand
Joined: Jun 2006
Posts: 956
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.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen
Joined: Jun 2006
Posts: 869
old hand
old hand
Joined: Jun 2006
Posts: 869
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.


http://clubadventist.com/forums

No longer following the carrot
Joined: Jun 2006
Posts: 956
Old Hand
Old Hand
Joined: Jun 2006
Posts: 956
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.dragonclan-forum.de
my hobby: http://www.biker-reise.de
Ich kann bei Fragen zu UBBthreads in Deutsch weiterhelfen oder es zumindest versuchen

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
1 members (Nightcrawler), 445 guests, and 142 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)