Autor Zpráva
S!4d4k
Profil *
Zdravim potreboval by som pomoct zo scriptom ktory by mi na webe ktori je robeny v php zobrazoval nove spravi z fora ak by niekto mal taky script mohol by mi hodit zdrojak?alebo napisat navod ako spravit taky script ak taky neni ?dakujem
WertriK
Profil *
Vyberes z databaze proste prispevek s nejvetsim id [... ORDER BY id LIMIT 1]
WertriK
Profil *
[... ORDER BY id DESC LIMIT 1]
S!4d4k
Profil *
hm no to si mi moc pomohol :D
WertriK
Profil *
Kdyz ty napises jenom ze chces zobrazit posledni prispevek.
To sem muzu psat kody a kody a zadny ti fungovat nemusi ponevadz nevim;
- jak mas strukturovanou db, jestli to vubec ukladas do db
- jak to chces zobrazit [styl]
atd.
S!4d4k
Profil *
sry moja chyba :)zobrazit to chcem z normal fora phpbb na web pisany v php a chcel by som to zobrazit ako to je tu www.punkdisasters.com nlavo prvy stlpec
S!4d4k
Profil *
uz sa to viriesilo


<?php

////////////////////////////////////////////////////////////////////// ////////
// Kozlikova SQL modifikace (diky, uz to chodi i na Pipni ;)) //
// Xsoftova modifikace (trochu uprav s datumem, cestinou, obr a komentarem) //
// - puvodni verzi jsem zaREMoval (//) .. kdyby chtel nekdo videt puv. verzi//
////////////////////////////////////////////////////////////////////// ////////

$phpbb_root_path = 'forum/'; //edit this to your phpBB root path
// $phpbb_root_path = './'; //tohle taky funguje

/* soubor mam nahrany v http://ddr.pocitac.com/posledni.php
takze cestu jsem dal "../ddrforum/"
ale fungovalo by i "./" nebo neco podobneho */

define('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

Function replacebbcode($text){

$text = eregi_replace("\[b:.{0,10}\]", "<b>", $text);
$text = eregi_replace("\[\/b:.{0,10}\]", "</b>", $text);
$text = eregi_replace("\[u:.{0,10}\]", "<u>", $text);
$text = eregi_replace("\[\/u:.{0,10}\]", "</u>", $text);
$text = eregi_replace("\[i:.{0,10}\]", "<i>", $text);
$text = eregi_replace("\[\/i:.{0,10}\]", "</i>", $text);
$text = eregi_replace("\[url=http:.{1,80}\]"," ",$text);
$text = eregi_replace("\[\/url\]"," ",$text);
$text = eregi_replace("\[url\]"," ",$text);
$text = eregi_replace("\[.{1,10}:.{1,10}\]"," ",$text);
$text = eregi_replace("\[\/.{1,10}:.{1,10}\]"," ",$text);
$text = eregi_replace("\[\/.{1,20}\]"," ",$text);
$text = eregi_replace("\[.{1,20}\]"," ",$text);
Return $text;
}

// various attributes - experiment!

$NUM_POSTS = 4;
$POST_IMAGE ="http://www.ultranet.ic.cz/templates/subSilverPlus/images/common/icon _latest_reply.gif"; // icon next to each item <<< OBRAZEK <<<
$TEXT_ON = FALSE; //display some of the text of the post?
$TEXT_LEN = 30; //number of chars if above is true
$HIDE = true;//true or false - if true, do not show posts from certain forums - see below
$hide_level = 0;// display threshold 0=only show posts in forums open for guest reading,1= also registered, 2=also Mods only 3=show ALL posts even those froums for admins only
$fontheadersize="1";
$fontheadercolor="black";
$fontsize=1;
$fontcolor="#5695BA";
$fontsizetext=1;
$fontcolortext="#5695BA";
$fontheaderface="verdana";
$box_content = "";

//$time=time();
//$time=date("d M Y h:i a",$time);
//$time=date("D, j.M Y, G:i",$time); // jsme v cechach, tak cesky format casu

//$sqlxx="SELECT a1.post_id AS postid, a1.poster_id AS poster, a1.forum_id, a1.topic_id AS topic, a1.post_time AS time, a2.post_subject AS subject, a2.post_text AS text FROM phpbb_posts a1, phpbb_posts_text a2, phpbb_forums a3 WHERE a1.post_id = a2.post_id AND a1.forum_id = a3.forum_id";
$sqlxx="SELECT a1.post_id AS postid, a1.poster_id AS poster, a1.forum_id, a1.topic_id AS topic, a1.post_time AS time, a2.post_subject AS subject, a2.post_text AS text FROM ".$table_prefix."posts a1, ".$table_prefix."posts_text a2, ".$table_prefix."forums a3 WHERE a1.post_id = a2.post_id AND a1.forum_id = a3.forum_id";

if($HIDE) $sqlxx .= " AND a3.auth_view <= \"" . $hide_level . "\"";

$sqlxx .= " ORDER BY a1.post_time DESC";

$resultxx = mysql_query($sqlxx) or die("Cannot query database - asi mas blbe nastaveny adresar");

if($resultxx){

$box_content .="<table cellpadding=\"0\" cellspacing = \"0\" width= \"100%\" border=\"0\">";
for($i=0;$i<$NUM_POSTS;$i++){
if($post = mysql_fetch_array($resultxx)){
//$result3=mysql_query("SELECT username FROM phpbb_users WHERE user_id =" . $post["poster"]);
$result3=mysql_query("SELECT username FROM ".$table_prefix."users WHERE user_id =" . $post["poster"]);
$author=mysql_fetch_array($result3);
//$result4 = mysql_query("SELECT forum_name FROM phpbb_forums WHERE forum_id =" . $post["forum_id"]);
$result4 = mysql_query("SELECT forum_name FROM ".$table_prefix."forums WHERE forum_id =" . $post["forum_id"]);
$forum=mysql_fetch_array($result4);
if(!$post["subject"]){
//$result2=mysql_query("SELECT topic_title FROM phpbb_topics WHERE topic_id =" . $post["topic"]);
$result2=mysql_query("SELECT topic_title FROM ".$table_prefix."topics WHERE topic_id =" . $post["topic"]);
$replyto = mysql_fetch_array($result2);
$post["subject"]="RE: " . $replyto["topic_title"];
mysql_free_result($result2);
}
$box_content .="<tr><td ><font size=\"$fontsize\" color=\"$fontcolor\" face=\"$fontheaderface\"><img src=\"$POST_IMAGE \" width=\"18\" height=\"9\" ><a href=\"" . $phpbb_root_path . "/viewtopic.php?t=" .$post["topic"] . "\" title=\"Posted by:" . $author["username"]. " &nbsp;&nbsp; In:" . $forum["forum_name"] . "\">&nbsp;" . $post["subject"] . "</a><br> " . date("d.m.y ", $post["time"]) . date("H:i", $post["time"]) . "</font></td></tr>";
if($TEXT_ON){
$post["text"] = replacebbcode($post["text"]);
$post["text"] = substr($post["text"],0,$TEXT_LEN);
$box_content .= "<tr><td cellpadding=\"0\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"$fontcolortext\" size=\"$fontsizetext\" face=\"$fontheaderface\">" . $post["text"] . "...</font></td></tr>";
}
}
}
$box_content .="</table>";
}

print("<table width=\"140\"><tr><td>" . $box_title . "</td></tr><tr><td><font size=\"$fontsize\" color=\"$fontcolor\" face=\"$fontheaderface\">Poslední příspěvek:<br>". date("j. m Y, G:i", time()). "</font></td></tr><tr><td>" . $box_content . "</td></tr></table>");
?>
Toto téma je uzamčeno. Odpověď nelze zaslat.

0