Проблем с последни теми от форума на сайта ми

cocobrais

Registered
Ползвам един код за последни теми от форума, но както виждам май не извиква темите в които последно е писано....Малко хелп??

Код:
$broi_temi="20"; // Колко последни теми да показва
$broi_bukvi="30"; //До колко букви от заглавието на темата да показва
mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database");
$query="SELECT c.topic_time , c.topic_title,c.forum_id,c.topic_id, c.topic_replies,c.topic_type FROM phpbb_topics c, phpbb_forums f WHERE c.forum_id=f.forum_id and f.auth_view like '0' ORDER BY c.topic_time ";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$ii=$num-$broi_temi;


for ($i=$num-1; $i>$ii;$i--)
{
$tema=mysql_result($result,$i,"c.topic_title");
$id=mysql_result($result,$i,"c.forum_id");
$topic_broi=mysql_result($result,$i,"c.topic_replies");
$topic_id=mysql_result($result,$i,"c.topic_id");
$topic=mysql_result($result,$i,"c.topic_type");
if($topic=="1")
{$vazna='Важна:';}
elseif($topic=="2")
{$vazna='Съобщение:';}
elseif($topic_status=="1")
{$vazna='Заключена:';}
else
{$vazna='';}

if (strlen($tema)>$broi_bukvi)
{$totchki='...';}
else
{$totchki='';}

$tema=substr($tema,0 , $broi_bukvi);
echo" » $vazna<a href='http://................................./viewtopic.php?t=$topic_id' >$tema$totchki ($topic_broi)</a><br/>";
}


?>
 
mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database");

ето тук също си напиши това което трябва


localhost,$user,$pass


$db
 
Това устройва ли те или държиш да се преработи твоя код?

http://roverclub-bg.com/topics.php
 
djvato каза:
mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database");

ето тук също си напиши това което трябва


localhost,$user,$pass


$db

Просто съм скрил името на бд и паролата.Всичко ми се показва само че не май актуални...


porostorm - перфектно ми е.....
 
cocobrais каза:
porostorm - перфектно ми е.....
Код:
<?php
//phpBB - last topics
//Email: bobi@wthost.net
//Name: Bobi Haidar
// http://web-tourist.net
// редактирано от porostorm - porostorm@abv.bg


$user=""; //DB user
$pass=""; //DB pass
$db=""; //DB name
$address=""; //address
$broi_temi="11"; // Колко последни теми да показва
$broi_bukvi="27"; //До колко букви от заглавието на темата да показва
$broi_bukvi2="30"; //До колко букви от заглавието на темата да показва категорията

mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database");
$query="SELECT c.topic_time , c.topic_last_post_id, c.topic_title,c.forum_id,c.topic_id, c.topic_replies, c.topic_views, c.topic_type,f.forum_name FROM phpbb_topics c, phpbb_forums f WHERE c.forum_id=f.forum_id and c.forum_id != 13 && c.forum_id != 26 && c.forum_id != 12 and f.auth_view like '0' ORDER BY c.topic_last_post_id ";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$ii=$num-$broi_temi;


for ($i=$num-1; $i>$ii;$i--)
{
$tema=mysql_result($result,$i,"c.topic_title");
$id=mysql_result($result,$i,"c.forum_id");
$topic_broi=mysql_result($result,$i,"c.topic_replies");
$topic_url=mysql_result($result,$i,"c.topic_last_post_id");

$topic_id=mysql_result($result,$i,"c.topic_id");
$topic=mysql_result($result,$i,"c.topic_type");
$cat=mysql_result($result,$i,"f.forum_name");
$views=mysql_result($result,$i,"c.topic_views");

if (strlen($tema)>$broi_bukvi)
{$totchki='...';}
else
{$totchki='';}



$tema=substr($tema,0 , $broi_bukvi);
if 
(strlen($cat)>$broi_bukvi2)
{$totchki2='...';}
else
{$totchki2='';}
$cat=substr($cat,0 , $broi_bukvi2);
echo"$cat$totchki2<br /><a href='$address/viewtopic.php?p=$topic_url#$topic_url' target='_blank'>$tema$totchki</a> ($topic_broi)<br />";
}
?>
 
Леле направо заспа....Ако ми пратиш и css само за линиите които се редуват
 
cocobrais каза:
Леле направо заспа....Ако ми пратиш и css само за линиите които се редуват
Това не беше css. Това бяха таблици. Нарочно ги махнах. Сега ти можеш да си го модифицираш както си искаш. :)
 
cocobrais каза:
Така ми пасваше перфектно...Мерси все пак...
Мога да ти го дам и с таблиците, не ми е проблем.
Но по-добре ти си го нагоди както искаш ;)
 
Код:
<?php
echo "<table class=\"forumline\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" style=\"width: 227px\"><tbody>";
//phpBB - last topics
//Email: bobi@wthost.net
//Name: Bobi Haidar
// http://web-tourist.net


$user=""; //DB user
$pass=""; //DB pass
$db=""; //DB name
$address=""; //address
$broi_temi="11"; // Колко последни теми да показва
$broi_bukvi="27"; //До колко букви от заглавието на темата да показва
$broi_bukvi2="30"; //До колко букви от заглавието на темата да показва категорията

mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database");
$query="SELECT c.topic_time , c.topic_last_post_id, c.topic_title,c.forum_id,c.topic_id, c.topic_replies, c.topic_views, c.topic_type,f.forum_name FROM phpbb_topics c, phpbb_forums f WHERE c.forum_id=f.forum_id and c.forum_id != 13 && c.forum_id != 26 && c.forum_id != 12 and f.auth_view like '0' ORDER BY c.topic_last_post_id ";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$ii=$num-$broi_temi;


for ($i=$num-1; $i>$ii;$i--)
{
$tema=mysql_result($result,$i,"c.topic_title");
$id=mysql_result($result,$i,"c.forum_id");
$topic_broi=mysql_result($result,$i,"c.topic_replies");
$topic_url=mysql_result($result,$i,"c.topic_last_post_id");

$topic_id=mysql_result($result,$i,"c.topic_id");
$topic=mysql_result($result,$i,"c.topic_type");
$cat=mysql_result($result,$i,"f.forum_name");
$views=mysql_result($result,$i,"c.topic_views");

if (strlen($tema)>$broi_bukvi)
{$totchki='...';}
else
{$totchki='';}



$tema=substr($tema,0 , $broi_bukvi);
if 
(strlen($cat)>$broi_bukvi2)
{$totchki2='...';}
else
{$totchki2='';}
$cat=substr($cat,0 , $broi_bukvi2);
echo"<tr bgcolor=\"#F3F3F3\">
<td colspan=\"2\" class=\"rowpic\" align=\"left\" valign=\"top\"><img src=\"index.php_files/news.gif\" alt=\"Rover Техническа Литература Книги\" /> $cat$totchki2</td></tr>
<tr class=\"onmovr\" onmouseover=\"this.style.backgroundColor='#FFFFFF'\" onmouseout=\"this.style.backgroundColor=''\">
<td class=\"rowpic\" style=\"border-top-style: none; border-top-width: none;\">
<img src=\"index.php_files/arrow.gif\" border=\"0\" alt=\"Rover Купувам Продавам Ровър\" /> <a class='gensmall' href='$address/viewtopic.php?p=$topic_url#$topic_url' target='_blank'>$tema$totchki</a></td>
<td class=\"rowpic\" align=\"right\" style=\"border-top-style: none; border-top-width: none;\" width=\"1\">$topic_broi</td></tr>";
}
echo "</tbody></table>";
?>
Забравих да ти кажа, че този ред
Код:
and c.forum_id != 13 && c.forum_id != 26 && c.forum_id != 12
са форумите, от които да не чете последните теми.

Можеш да го махнеш или да си сложиш други форуми, които не искаш да чете.
 

Back
Горе