Welcome to Geeklog, Anonymous Monday, December 09 2024 @ 11:47 am EST

Geeklog Forums

Display last phpBB topic in Geeklog's Home Page


Status: offline

kreative

Forum User
Chatty
Registered: 08/15/04
Posts: 53
Location:Verona, Italy
Hello,
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
<?php

// 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>";

mysql_close($db);
?>
 
 Quote

Status: offline

beewee

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
 Quote

All times are EST. The time is now 11:47 am.

  • 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