Welcome to Geeklog, Anonymous Thursday, May 30 2024 @ 06:11 pm EDT

Geeklog Forums

Display last phpBB topic in Geeklog's Home Page

Status: offline


Forum User
Registered: 08/15/04
Posts: 53
Location:Verona, Italy
I'm trying to create a PORTAL BLOCK (or php block?) to show in geeklog's home page last 10 posts in my phpbb forum.

This is the PHPBB code, if I try to execute PHP in a blank page I receive the topic list (corecctly). But if I try to use in geeklog, creating a new portal block, I get an error:
mer 27 feb 2008 17:48:46 CET - Unable to aquire feed reader for http://www.xxx.it/test.php
mer 27 feb 2008 17:48:46 CET - Unable to parse XML Error Code: 9 Error Message: Invalid character

Can you check the php code and tell me where is the problem?

Text Formatted Code

// forum db access...

$db_host = 'localhost';
$db_name = 'name';
$db_user = 'username';
$db_password = 'password';

$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Connection Error.");
mysql_select_db($db_name, $db)
or die ("Error selecting database.");

// forum id you dont want to show

$query = "SELECT topic_id,topic_title FROM phpbb_topics WHERE forum_id !='7' AND forum_id !='44' AND forum_id !='29' AND forum_id !='25' AND forum_id !='54' AND forum_id !='62' AND forum_id !='66' AND forum_id !='60' ORDER BY topic_last_post_id DESC LIMIT 0,10";

$result = mysql_query($query, $db);

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\" \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">";
echo "<rss version=\"0.91\">";
echo "<channel>";

echo "<title>title</title>";
echo "<link>forum link</link>";
echo "<description>forum description</description>";

while ($row = mysql_fetch_array($result))
{ echo "<item>";
echo "<title>$row[topic_title]</title>";
echo "<link>http://www.xxx.it/forum/viewtopic.php?t=$row[topic_id]</link>";
echo "<description></description>";
echo "</item>"; }

echo "</channel>";
echo "</rss>";


Status: offline


Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
A portal block is only for parsing RSS feeds, not PHP. I'm no developer/coder, but I believe you need to put that PHP code in lib-custom.php (in system directory), give that function a name and call that function by that name in a PHP block.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net

All times are EDT. The time is now 06:11 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content