FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Displaying a forum outside of the forum software
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Displaying a forum outside of the forum software [message #36000] Tue, 27 February 2007 15:55 Go to next message
walt is currently offline  walt   United States
Messages: 3
Registered: February 2007
Karma: 0
Junior Member
I'm trying to use one of the forums as a blog for the main page.

I figured that I should be able to use a simple mysql select statement to get the thread_id's of one forum and then use fud_fetch_msg() to get the post. When I do this I get:
Quote:


Warning: mysql_connect(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/b/m/o/user/FUDforum/include/theme/default/db.inc on line 16

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/content/b/m/o/user/FUDforum/include/theme/default/db.inc on line 16

Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/content/b/m/o/user/FUDforum/include/theme/default/db.inc on line 16

Fatal error: SQL Error has occurred, please contact the administrator of the forum and have them review the forum's SQL query log in /home/content/b/m/o/user/FUDforum/include/core.inc on line 188


If I separate it into two separate tasks, they both work fine. The sql query is returning the proper thread_ids and if I use a thread_id with fud_fetch_msg(), everything is returned correctly.

I think the problem is that I'm using my own mysql_connection that I manually create and close instead of the same one that fudapi uses. Is there an easy way to use the fudapi or other fudcode to connect to the db so they wont cause problems?
Re: Displaying a forum outside of the forum software [message #36009 is a reply to message #36000] Wed, 28 February 2007 01:09 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Open the FUDforum connection (load API) after you've opened your own mysql connection.

FUDforum Core Developer
Re: Displaying a forum outside of the forum software [message #36010 is a reply to message #36009] Wed, 28 February 2007 04:36 Go to previous messageGo to next message
walt is currently offline  walt   United States
Messages: 3
Registered: February 2007
Karma: 0
Junior Member
Ilia wrote on Tue, 27 February 2007 20:09

Open the FUDforum connection (load API) after you've opened your own mysql connection.


I've tried searching for FUDforum connection, load api, and mysql connection and haven't found anything about this. I've also looked in the db.inc, globals.php, and core.inc files and found nothing. Where can I find information on the load API?

Also, it seems as if just include of fudapi causes those errors. Without anything else in the file.

[Updated on: Wed, 28 February 2007 05:16]

Report message to a moderator

Re: Displaying a forum outside of the forum software [message #36039 is a reply to message #36010] Thu, 01 March 2007 00:17 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
I think you maybe be forgetting to load GLOBALS.php

FUDforum Core Developer
Re: Displaying a forum outside of the forum software [message #36043 is a reply to message #36000] Thu, 01 March 2007 00:36 Go to previous messageGo to next message
walt is currently offline  walt   United States
Messages: 3
Registered: February 2007
Karma: 0
Junior Member
That made me think to try something...

I put this in a file in the root dir of the website.

<?
include('/home/content/b/m/o/user/FUDforum/scripts/fudapi.inc.php');
$msg = fud_fetch_msg('3');
echo $msg->body;
?>


I named it db_test.php. Everything worked perfectly fine. However, when I put that file in my include directory and include it with a url like /?page=db_test, it gives those mysql errors. So I don't know why it's doing that but I'm going to keep looking into it or find a workaround.

[Updated on: Thu, 01 March 2007 00:37]

Report message to a moderator

Re: Displaying a forum outside of the forum software [message #39152 is a reply to message #36000] Wed, 03 October 2007 21:15 Go to previous message
pgregg is currently offline  pgregg   United Kingdom
Messages: 14
Registered: July 2006
Karma: 0
Junior Member
I do (well doing... forum isn't live yet) this via a RSS feed and MagpieRSS http://magpierss.sourceforge.net/

include '/web/common/magpierss-0.72/rss_fetch.inc';
define('MAGPIE_CACHE_DIR', '/web/domain.com/production/attachments/cache');
$rss = fetch_rss('http://www.domain.com/community/rdf.php?mode=m&l=1&basic=1');
$discussions_seen = array();
$discussions_displayed = 0;
foreach ($rss->items as $idx => $item) {
  if ($discussions_displayed == 5) break;
  $tmp_title = $item['title'];
  $tmp_link = $item['link'];
  if (strpos($tmp_title, 'Re: ')===0) $tmp_title=substr($tmp_title, 4); // strip the Re:
  if (isset($discussions_seen[$tmp_title])) continue; // only show the latest post in a thread
  $discussions_seen[$tmp_title] = true;
  printf("<p class='bodytext'><a href='%s'><img src='/images/version2_dec03/arrow.gif' border='0' alt=''><font color='$gray'>%s</font></a><br></p>\n",
    $tmp_link, $tmp_title);
  $discussions_displayed++;
}
unset($discussions_seen, $discussions_displayed, $rss, $idx, $item, $tmp_title, $tmp_link);


Obviously this is trivially easy to change to any forum/category - just change the RSS url.

Hope this helps,
PG

[Updated on: Wed, 03 October 2007 21:24]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Compact view of "Unread Messages"
Next Topic: Hack for FUD 2.3.7 - Import Users from a CSV File
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 22:28:21 GMT 2024

Total time taken to generate the page: 0.04537 seconds