| :: |
| Author |
Message |
JanoF

Joined: 30 May 2006 Posts: 43
|
Posted: Sun Sep 10, 2006 11:34 am Post subject: Last 10 topics on web |
|
|
This use on the Web, outside phpbb
| Code: | <?php
$topicnumber = 10;
$urlPath = "http://www.phpbb.sk";
include 'config.php';
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.topic_status <> 2 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");
print "<table class='bodyline' width='180' border='0' cellspacing='1' cellpadding='4'><tr><td class='cat' align='center'><span class='cattitle'>Posledné témy</span></td></tr>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<tr><td class='row1'><span class='siteTextMed'>• " . date('d M Y', $row["post_time"]) . "</span><br /><span class='siteTextSmall'><a href=\"$urlPath/viewtopic.php?t=$row[topic_id]\">" . $row["topic_title"] . "</a></span></td></tr>";
}
print "</table>";
mysql_free_result($result);
?> |
He knew could this somebody adjust like this that it will be screen seo addresses et non viewtopic.php?t=1
thx |
_________________ www.pcforum.sk | www.pcforum.cz | jan.fecik.sk |
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
JanoF

Joined: 30 May 2006 Posts: 43
|
|
| Back to top |
|
 |
JanoF

Joined: 30 May 2006 Posts: 43
|
Posted: Sun Sep 10, 2006 8:32 pm Post subject: Re: Last 10 topics on web |
|
|
| dcz wrote: | Maybe you could start working from this script, as it's already checking censoring and such.
It should be easy to adapt the output to what you like.
++ |
I was trying this and doesn't work this repair me this this www.phpbb.sk/viewtopic.php?t= et non rewrite record |
_________________ www.pcforum.sk | www.pcforum.cz | jan.fecik.sk |
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
JanoF

Joined: 30 May 2006 Posts: 43
|
Posted: Mon Sep 11, 2006 1:06 pm Post subject: Re: Last 10 topics on web |
|
|
| dcz wrote: | Try quoting my post and grab the code from there, there is a problem (it's adding spaces in the text breaking the code) with the wrapping function I never have time to fix  | ok, thx |
_________________ www.pcforum.sk | www.pcforum.cz | jan.fecik.sk |
|
| Back to top |
|
 |
JanoF

Joined: 30 May 2006 Posts: 43
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
JanoF

Joined: 30 May 2006 Posts: 43
|
Posted: Tue Sep 12, 2006 12:00 pm Post subject: Re: Last 10 topics on web |
|
|
| Code: | <?php
$topicnumber = 10;
$urlPath = "http://www.phpbb.sk";
include 'config.php';
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.topic_status <> 2 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");
print "<table class='bodyline' width='180' border='0' cellspacing='1' cellpadding='4'><tr><td class='cat' align='center'><span class='cattitle'>Posledné témy</span></td></tr>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<tr><td class='row1'><span class='siteTextMed'>• " . date('d M Y', $row["post_time"]) . "</span><br /><span class='siteTextSmall'><a href=\"$urlPath/viewtopic.php?t=$row[topic_id]\">" . $row["topic_title"] . "</a></span></td></tr>";
}
print "</table>";
mysql_free_result($result);
?> |
And non-he shows me references to last contribution but only on a given subject |
_________________ www.pcforum.sk | www.pcforum.cz | jan.fecik.sk |
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
|
|