#1414
07/19/2006 12:48 PM
|
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
Former Developer
|
Former Developer
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
<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
Former Developer
|
Former Developer
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
$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
|
|
|
|
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:
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 );
}
$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\" />";
$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?
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
The first problem I see is at the bottom. This portion:
echo <<<PPPRINT
$tbopen
<tr>
<td class="tdheader" colspan="5" align="center">
Featured Photos
</td>
</tr>
$featured
$tbclose<br />
PPPRINT;
That should be:
$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.
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
Former Developer
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.
|
|
|
|
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:
require_once("/your/path/to/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 );
}
$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\" />";
$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);
mysql_select_db ("dbname")or die("Could not select database");
$body = <<<PPPRINT
$featured
PPPRINT;
|
|
|
|
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?? "; // 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?
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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.phpI 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.
|
|
|
Bots
by Outdoorking - 04/13/2024 5:08 PM
|
|
|
|
|
|
1 members (Nightcrawler),
445
guests, and
142
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|