Jump to content
php.lv forumi

Kads var iedot


limit

Recommended Posts

ludzu varetu pievienot lai tsrada manam skriptam un iemest seit ieks!

 

<?php

$platums = "160"; // platums px

$forums = "forums"; // foruma url

$limits = "5"; // cik daudz jaunumi uzradisies

$host = "localhost"; // db hosts

$dbname = "db"; // foruma datubaze

$dbuser = "db"; // foruma db users

$dbpass = "pw"; // juusu foruma datubaazes parole

$link = mysql_connect($host, $dbuser, $dbpass)

or die("NEsanaaca piekontektities: " . mysql_error());

mysql_select_db($dbname) or die("Datubaaze neekstistee");

mysql_query("SET NAMES UTF-8"); // lai rada LV alfabetu

 

// dabuunam datus no DB

$kverisdivi = mysql_query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post, views FROM ibf_topics ORDER

BY last_post DESC LIMIT ".$limits."");

 

 

 

echo "<div style='left;'><font size='1pt'>";

// izvadam jaunumus

while($row = mysql_fetch_array( $kverisdivi )) {

$datums = $row['start_date'];

$piev_datums = date("d/m/Y : H:i:s",$datums);

 

echo "<div style='left;'><a href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\"

 

title=\"\"><b><font color='#52504c'>".(strlen($row['title'])>15?substr($row['title'],0,15).'...':$row['title'])."</b></font></a> (".$row[posts].")

<br>Atbild: <a href=\"$forums/index.php?showuser=".$row[last_poster_id]."&view=getnewpost\"

 

title=\"\">".$row[last_poster_name]."</a><br>Apskatits: <font color='#676767'>".$row[views]."</font> reizes</div><hr>";

}

echo "</font></div>";

?>

Link to comment
Share on other sites

Kas tas par <div style="left;">...

 

CSS

.abc a {
 display: block;
 background-color: #000;
 color: #fff;
 padding: 3px;
}

.abc a:hover {
 background-color: #fff;
 color: #000;
}

 

echo "<div class='abc'>";
while($row = mysql_fetch_array($kverisdivi)) {
$datums = $row['start_date'];
$piev_datums = date("d/m/Y : H:i:s", $datums);

echo "<a href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\"

title=\"\"><b><font color='#52504c'>".(strlen($row['title'])>15?substr($row['title'],0,15).'...':$row['title'])."</b></font></a> (".$row[posts].")
<br>Atbild: ".$row[last_poster_name]."<br />Apskatits: <font color='#676767'>".$row[views]."</font> reizes</div></a><hr>";
}
echo "</div>";

Edited by kechums
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...