php - 博客CMS的一些问题

标签 php mysql content-management-system blogs

我正在编写自己的博客 cms。我想在其中编写以下功能。

Public Area:

1.导航栏。

2.Posts在索引页里面包含。小贴图然后贴标题,贴内容200字左右。然后是一个阅读更多按钮,它将把用户带到完整的帖子页面。

Admin Area:

1.帖子CRUD(创建读取更新删除)。

2.General Information CRUD,如 Title Meta Keyowords 和其他一些东西。

What i can do from the above is:

1.我可以从数据库中抓取帖子内容等。

  1. 我可以创建帖子 CRUD。

我需要帮助的事情是: 我如何创建完整的帖子页面意味着当用户点击“阅读更多”按钮或帖子标题时,它将把用户带到完整的帖子页面。我不知道这一切是如何运作的。 您能否解释一下我如何创建它,我将如何为此管理数据库。这看起来很简单,但我不知道该怎么做。 如果可能,任何具有此功能的示例简单 cms(不是 wordpress 和其他)。有关如何执行此操作的任何教程? 任何帮助将不胜感激。 多谢 Jasmine

最佳答案

我相信您正在寻找术语“CRUD”= 创建、读取、更新、删除。 http://en.wikipedia.org/wiki/Create,_read,_update_and_delete

How i can create the full post page means when user clicks on Read More button or post title it will take the user to full post page. I don't know how this whole things works.

其实很简单。您需要使用 $_GET 来获取一些与特定帖子相关联的值,例如,如果您有一个如下表:

id title body created

将帖子与 id 相关联是有意义的。然后你会有一个文件,我们称之为“read.php” 在该文件中,您需要获取 $_GET 值,然后查询该 ID 关联的帖子:

伪:

    <?php

    if (isset($_GET['id'])) {
     $id = $_GET['id']; //Make sure the value is of integer before continuing

     $query = mysql_query("SELECT id, title, body, created FROM posts WHERE id = $id");

     $row = mysql_fetch_assoc($query);

     //present the result


echo "<h1>" . $row['title'] . "</h1>";
echo "<div>" . $row['body'] . "</div>";

//etc..

    }

记住要防止 XSS。 http://shiflett.org/articles/cross-site-scripting

关于php - 博客CMS的一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10663712/

相关文章:

php - 如何在while循环中重复整个表

php - 错误 '.$row["column_name_here"]。'编码

mysql - 分类网站的数据库结构

c# - ASP.NET 的 Wordpress 等价物

php - 什么是最好的用户限制?

php:在异常处理程序中处理异常?

php - 使用 PHP 解析 Google Calendar XML - 结束日期相差一天

php - 将单词拆分为 span 并在 div 中对齐

django - Django 和 Joomla 有什么区别?

PHP + MySQL + 重复日历事件