IPB forum...
quoto lo script che avevo trovato così riesco a spiegare meglio come sono strutturate le tabelle (non sono capace in altro modo )
codice:
<?php
////////////////////////////////////////
// Shorten Function - No Need to edit //
////////////////////////////////////////
function shorten($text, $length)
{
if(strlen($text) > $length)
{
$text = substr(trim($text), 0, $length - 3);
$shorten_by = strlen(strrchr($text, " "));
if($shorten_by > 0 && $shorten_by < $length / 2) $text = substr($text, 0, -$shorten_by);
while(preg_match("/[-,.]$/i", $text)) $text = substr($text, 0, -1);
$text .= "...";
}
return htmlentities($text);
}
//
// Include most recent news from database
//
// Edit the database variables to match your invision database.
// Edit the forum id to match that of the forum in which you wish to extract posts from.
//
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("database name", $db);
$newsheadline = mysql_query("SELECT * FROM ibf_topics WHERE forum_id='1' ORDER BY 'tid' DESC LIMIT 1", $db);
$news = mysql_query("SELECT * FROM ibf_posts WHERE forum_id='1' ORDER BY 'pid' DESC LIMIT 1", $db);
$rows = mysql_num_rows($newsheadline);
$rows--;
$link = mysql_result($newsheadline, $rows, 'tid');
$title = mysql_result($newsheadline, $rows, 'title') or mysql_error($db);
$rows = mysql_num_rows($news);
$rows--;
$bodyo = mysql_result($news,$rows,'post');
$bodyo = shorten($bodyo, "325");
// Edit the paths to match your forum.
// Note: The path must relevant to your web root ( If you place this file in www.yourdomain.com/football,
// then the path would be ../yourforum/index.php?showtopic=$link\">Click Here to read the full story..</a>";
$info ="<a href=\"./yourforum/index.php?showtopic=$link\">Click Here to read the full story..</a>";
$body.="<a href=\"./yourforum/index.php?showtopic=$link\">$title</a>";
// Display Title
$body = html_entity_decode($body);
print $body;
//
// End of Include
//
?>
<div align="center"></div></td>
</tr>
<tr>
<td height="63" bgcolor="#EEF1F8">
<table width="90%" border="0" align="center">
<tr>
<td>
<?php // Display post
$bodyo = html_entity_decode($bodyo);
print $bodyo;?>
<?php // Display Link
$info = html_entity_decode($info);
print $info;?>
</p>