我有我希望如何为 CSS 显示日期的跨度:
.date {
float:left;
position:relative;
margin-right:10px;
padding:45px 5px 0;
}
.date .month{
text-transform:uppercase;
font-size:25px;
}
.date .day{
font-size:35px;
line-height:45px;
position:absolute;
left:5px;top:0;
}
.date .year{
display:block;
position:absolute;
right:-5px;
top:15px;
-webkit-transform:rotate(-90deg);
-moz-transform:rotate(-90deg);
-ms-transform:rotate(-90deg);
-o-transform:rotate(-90deg)
}
在 PHP 的输出中最终看起来像这样:http: //puu.sh/1uqZ2
到目前为止,我已经设置了我的 CMS(新闻系统),但是我将如何让它看起来像该图像中显示的时间戳?我是否必须为每行设置每个标签,例如 $day $month $year?
这是我当前的“addarticle.php”页面:
<?php
$submit = $_POST['submit'];
$remove = $_POST['remove'];
$news_content = $_POST['newscontent'];
$news_title = mysql_real_escape_string($_POST['newstitle']);
$news_author = mysql_real_escape_string($_POST['newsauthor']);
$news_date = date("l, F jS Y");
if ($submit)
{
$namecheck = mysql_query("SELECT news_title FROM articles WHERE news_title='$news_title'");
$count = mysql_num_rows($namecheck);
if ($count!=0)
{
die ('<div class="red" style="margin-bottom: 0;">Article <strong>'.$news_title.'</strong> already exists!</div>
<meta http-equiv="REFRESH" content="2;url=index">
');
}
if ($news_title&&$news_content&&$news_author)
{
$query = mysql_query("
INSERT INTO articles VALUES ('','$news_title','$news_content','$news_date','$news_author')
");
echo "<div class='green'>You have posted <strong>$news_title</strong> !</div>";
}else {
echo '<div class="red">You must fill in all fields!</div>';
}
}
?>
<form action="" method="POST">
Article Title :
<br />
<input name="newstitle" type="text" class="userpass" />
<br /><br />
Article Author :
<br />
<input name="newsauthor" type="text" class="userpass" value="<?php echo $_SESSION['username'] ?>" />
<br /><br />
Article Content :
<br />
<textarea id="elm1" name="newscontent" rows="7" cols="30" style="width: 100%"> </textarea>
<br />
<input name="submit" type="submit" class="button" value="Post News" />
<a href="viewarticle"><input name="edit" type="button" class="button" value="Edit Article" /></a>
</form>