| Author |
Message |
Argus Client

Joined: Oct 06, 2003 Posts: 81
|
Posted:
Thu Oct 16, 2003 4:57 pm |
|
Heya...
I'm having a small problem with a block atm. Here's the block:
| Code: |
<?php
/************************************************/
/* Last Posts from Invision Board */
/* A block for phpNuke 6.0 - 6.6 */
/* By Patrick (http://www.actionrpg.net) */
/* */
/* All credit goes to: */
/* Holbrookau - http://phpnuke.holbrookau.com */
/* VladOr - http://www.cm4.ru */
/* */
/* All I have done is combined those two. The */
/* VladOr block hardly worked for me, and the */
/* Holbrookau block required a shared database. */
/* Thank you for downloading. I hope you enjoy! */
/************************************************/
if (eregi("block-IPB_last_posts.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
global $admin;
$ibf_sql_host = "localhost";
$ibf_sql_user = "XXXX"; // DB username
$ibf_sql_password = "XXXX"; // DB password
$ibf_sql_dbname = "forums"; // DB name
$ibf_path = "forums/index.php"; // path from phpNuke root directory to IPB index.php
$ibf_table_prefix = "ibf_"; // change if your IPB table prefix is not ibf_
$limit = "10"; // How many threads would you like to display?
$noshow = "0"; // Don't show posts from these forums - seperate IDs with commas, eg: "2,8"
$scroll = "1"; // Scroll - 1=On, 0=Off
$ibf_connect = mysql_connect($ibf_sql_host, $ibf_sql_user, $ibf_sql_password);
if(!$ibf_connect)
{
echo $content="<div style=\"font-color:#ff0000; font-weight:bold;\">Error: Could not connect to database server</div>";
}
else
{
$ibf_db = mysql_select_db($ibf_sql_dbname, $ibf_connect);
if (is_admin($admin))
{
$ibf_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id FROM ".$ibf_table_prefix."topics ORDER BY last_post DESC LIMIT ".$limit, $ibf_connect);
}
else
{
$ibf_query = mysql_query("SELECT DISTINCT tid, title, last_poster_name, last_poster_id, forum_id FROM ".$ibf_table_prefix."topics WHERE forum_id NOT IN ($noshow) ORDER BY last_post DESC LIMIT ".$limit, $ibf_connect);
}
if ($scroll=="1")
{
$content = " <MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"150\" scrollamount= \"1\" scrolldelay= \"10\" onmouseover='this.stop()' onmouseout='this.start()'>";
}
while($ibf_result = mysql_fetch_row($ibf_query))
{
$content .= "<br><b><strong><big>·</big></strong> <a href=\"/".$ibf_path."?act=ST&f=".$ibf_result[4]."&t=".$ibf_result[0]."&view=getnewpost\">".$ibf_result[1]."</a></b> <i>by ";
if($ibf_result[3] != 0)
{
$content .= "<a href=\"".$ibf_path."?act=Profile&CODE=03&MID=".$ibf_result[3]."\">".$ibf_result[2]."</a></i><br>\n";
}
else
{
$content = $ibf_result[2]."</i></p>\n";
}
}
mysql_free_result($ibf_query);
}
mysql_close($ibf_connect);
?> |
The block works, however any block or even module (if its on the right) that loads after it gets no input. They show up as no content now for this block etc. Does anyone know why this is happening?
Thanks much,
-Arg |
|
|
|
 |
scottr PHP-Portal Project

Joined: Jan 21, 2003 Posts: 41 Location: Southern California
|
Posted:
Thu Oct 16, 2003 5:48 pm |
|
Maybe get rid of that last mysql_close() statement ? |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Thu Oct 16, 2003 6:54 pm |
|
That's usually a sign that either a variable name is clashing with nuke or the form is maligned, meaning an open form tag or something. Can you provide a link so I can see this in action? |
|
|
|
 |
Argus Client

Joined: Oct 06, 2003 Posts: 81
|
Posted:
Thu Oct 16, 2003 10:05 pm |
|
I added the close thinking that was the problem, but nothing changed when I did. A link to the page is . Top right side. Site is a work in progress.
-Thanks |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Oct 17, 2003 5:07 am |
|
I clicked on the link and I don't see the problem. What am I missing? |
|
|
|
 |
Argus Client

Joined: Oct 06, 2003 Posts: 81
|
Posted:
Fri Oct 17, 2003 10:18 am |
|
Mmmm someone's been editting the page I think. I put the survey block and the big story of today block back in and you can see the prob.
-Arg |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Oct 17, 2003 1:11 pm |
|
Well, there may not be a biggest story and is the survey module active? The reason I ask is that there is a Gaming League's block that is working. Try moving the who's online block on the right to see if it works or not. |
|
|
|
 |
Argus Client

Joined: Oct 06, 2003 Posts: 81
|
Posted:
Fri Oct 17, 2003 1:55 pm |
|
Hehe, I think thats because its just content - pure html (the gaming league block) Here, I'll move it to the left side and you can see what happens
-Arg |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Oct 17, 2003 5:45 pm |
|
Well, I have looked at this for about an hour or more and I can't see anything wrong. The symptoms are as I said earlier. It's as if nuke thinks it's done building so I think there is a variable being used in the script that is confusing nuke. This is how I would debug it if it were me. I would rename these variables in the script to have a prefix of xxx_ (limit, noshow, scroll). Then, see if you still have the problem. Also, the variable $PHP_SELF should be $_SERVER['PHP_SELF']. Also, modify this code | Code: | | echo $content="<div style=\"font-color:#ff0000; font-weight:bold;\">Error: Could not connect to database server</div>"; | to | Code: | | $content="<div style=\"font-color:#ff0000; font-weight:bold;\">Error: Could not connect to database server</div>"; | That coding seems troublesome to me. |
|
|
|
 |
Argus Client

Joined: Oct 06, 2003 Posts: 81
|
Posted:
Sun Oct 19, 2003 3:34 pm |
|
Heyas...
I made the changes as suggested with no effect. Thanks for looking at it though. I was also trying to create a custom block by hacking another with no success. Do I understand you will take on small projects like this for $?
Thanks,
-Arg |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sun Oct 19, 2003 4:56 pm |
|
I do custom contracting work, yes. I also have a couple of people who I refer work to. Send me an email with your specs. |
|
|
|
 |
|
|
|
|