Hello vBulletin gurus,
I made a PHP script that displays data from a specific vBulletin forum. (I am a PHP noob, did it in Dreamweaver)
You can see the output here:
http://www.dvcreators.net/news.php
I am stuck on two things:
1. Instead of "1109707243", I would like a real date format :-) I would like to know how to display either absolute or relative ("Wednesday, March 23, 2005" or "4 hours ago")... vBulletin has a date function (vbdate[]?) but I am just too PHP-stoopid to figure it out.
2. Everywhere in the text of the post where there is a " [ u r l ] " or " [ / u r l ] " I would like to replace it with the proper actual HTML "<a href> </a> etc." so the text is a clickable link.
I included the code so far below just in case, I'm sure some of you PHP gurus will wince at the lousy DreamWeaver syntax.
Thanks in advance for any help!
-Josh
---- code start ----
Code:
<?php
require_once('Connections/dvc_mysql.php');
//require_once('./global.php'); do we need this for vbdate???
$maxRows_news = 10;
$pageNum_news = 0;
if (isset($_GET['pageNum_news'])) {
$pageNum_news = $_GET['pageNum_news'];
}
$startRow_news = $pageNum_news * $maxRows_news;
mysql_select_db($database_dvc_mysql, $dvc_mysql);
$query_news = "SELECT post.dateline, post.title, post.pagetext FROM post WHERE post.threadid = 7713 ORDER BY post.dateline";
$query_limit_news = sprintf("%s LIMIT %d, %d", $query_news, $startRow_news, $maxRows_news);
$news = mysql_query($query_limit_news, $dvc_mysql) or die(mysql_error());
$row_news = mysql_fetch_assoc($news);
if (isset($_GET['totalRows_news'])) {
$totalRows_news = $_GET['totalRows_news'];
} else {
$all_news = mysql_query($query_news);
$totalRows_news = mysql_num_rows($all_news);
}
$totalPages_news = ceil($totalRows_news/$maxRows_news)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>dv news</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.date {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
color: #666666;
}
.title1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #383368;
}
-->
</style>
</head>
<body>
<table border="0" cellpadding="4" cellspacing="0" class="date">
<?php do { ?>
<tr>
<td><?php echo $row_news['dateline']; ?></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="title1"><?php echo $row_news['title']; ?></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><?php echo $row_news['pagetext']; ?></td>
<td> </td>
<td> </td>
</tr>
<?php } while ($row_news = mysql_fetch_assoc($news)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($news);
?>
---- code end ----