所以我有一个问题,我需要一个答案。我正在为我的目的构建一个简单的CMS,我有一个“meta标签”框,在那个框中我会做类似的事情:“tag1,tag 2,tag 3,tag4”。
现在在我的博客页面上,它会显示:http://screencloud.net/img/screenshots/cb4088a27f8792108bbc8015eb554ac6.png
对于我的HREF标记,这是代码:
<div class="post-meta">
<span class="author">By <a href="/about"><?php echo stripslashes($row['news_author']); ?></a></span><br>
<span class="date"><?php echo stripslashes($row['news_date']); ?></span><br>
<span class="comments">Comments: <a href="#">35</a></span><br>
<span class="metatags"><a href="#"><?php echo stripslashes($row['meta_keys']); ?></a></span>
</div>
这是“meta_keys”......我问的问题是,如果你知道我的意思,我将如何分离标签而不是所有标签?
这是完整的代码:
<?php
$amount_get = mysql_query("SELECT * FROM comment WHERE articleid='" . mysql_real_escape_string($_GET['id']) . "'");
$comments = mysql_num_rows($amount_get);
$grab = mysql_query("SELECT * FROM articles WHERE id='" . mysql_real_escape_string($_GET['id']) . "' LIMIT 1");
$grab = mysql_query("SELECT id, news_title, news_content, meta_keys, news_author, news_day, news_month, news_year, news_date FROM articles ORDER BY id DESC limit 3");
$news_day =$row['news_day'];
$news_month =$row['news_month'];
$news_year =$row['news_year'];
$meta_tags =$row['meta_keys'];
if (mysql_num_rows($grab)==0) {
echo "<div class='alert alert-note-x'>Sorry, it looks like their are no articles posted!</div>";
}
while($row = mysql_fetch_array($grab)){
?>
<div class="post">
<h2><a href="entry/<?php echo $row['id'] ?>.<?php echo stripslashes(str_replace(" ", "-", $row['news_title'])); ?>"><?php echo stripslashes($row['news_title']); ?></a></h2>
<div class="post-meta">
<span class="author">By <a href="/about"><?php echo stripslashes($row['news_author']); ?></a></span><br>
<span class="date"><?php echo stripslashes($row['news_date']); ?></span><br>
<span class="comments">Comments: <a href="#">35</a></span><br>
<span class="metatags"><a href="#"><?php echo stripslashes($row['meta_keys']); ?></a></span>
</div>