php - HTML5分页

标签 php javascript html css pagination

我一直在做一个非常简单的博客页面来记录我学习HTML5和CSS3的进度。到目前为止,我有 2 个非常基本的帖子。我想要创建的是每页 10 个帖子的限制,然后它将创建一个新页面,其中最新的帖子位于顶部,就像我看到的一些 Tumblr 博客一样。在页面底部,它将有“旧帖子”和“较新帖子”按钮,它们将循环后退或转发 10 篇博文。每当我创建新帖子时,它都会将第 10 篇帖子推送到上一页。最终,我还将创建一个博客存档,按月对我的帖子进行排序。用户将能够在一页上查看一个月内的所有帖子。我是 HTML5 和 CSS3 的新手,我愿意学习 javascript、php 或其他任何可以做到这一点的东西。任何帮助,甚至链接都将不胜感激。这是我目前所拥有的:

<head>
    <meta charset="utf-8">
    <title>SmithSite:Blog</title>
    <link rel="stylesheet" type="text/css" href="mycss.css">
    <link href='http://fonts.googleapis.com/css?family=Share' rel='stylesheet' type='text/css'>
    <!–[if lte IE 9]>
    <script src=”http://html5shiv.googlecode.com/svn/trunk/html5.js”></script>
    <![endif]–>
</head>
<body>
  <header>
    <h1>SmithSite</h1>
  </header>
  <nav>
    <div id="menu">
    <ul id="menu">
      <li><a href="index.html" title="Home">Home</a></li>
      <li><a href="about.html" title="About">About</a></li>
      <li><a href="blog.html" title="Blog" class="active">Blog</a></li>
    </ul>
    </div>
  </nav>
    <article>
      <header><h2>Adventures in HTML5 (Mon Mar  5 23:02:05 EST 2012)</h2></header>
      <p>So far, I've learned a little bit about HTML5 and CSS3. I've been using emacs as my editor. It has some very strance, but efficient keyboard shortcuts. It takes a little while to get used to, but I'm sure I'll get the hang of it. So far, I've created 3 buttons as you'll notice above. Next time, I'll try working on how to get this blog to span over multiple pages, or try to work out how to archive it.</p>
    </article>
    <article>
      <header><h2>My First Entry (02.24.12)</h2></header>
    <p>This is the contents of the article element. I can't tell if this will extend past the end of the page or not, but I'll just keep on typing until I see the result. I guess this is my first blog entry. I'm messing around with a little HTML and some CSS. I hope I can make a kickass webpage soon. Hey look, it automatically sets borders based on the style tag above! HTML5 is so smart!</p>
    </article>
</body>

最佳答案

纯 HTML 可以做你想做的事,但你将要做很多乏味的移动帖子,或者用某种脚本生成 html。

博客引擎正是您在这里寻找的。有一些从帖子列表生成一堆静态页面,或者有一些需要数据库后端。

对于前者,您不必担心安全问题,因为您提供的只是静态页面。您唯一需要担心的是您的基本网络服务器的安全性。

使用动态解决方案,您可以获得实时评论和发布、搜索以及其他类似功能的所有好处,但代价是潜在的安全风险和博客服务器上的更多负载软件和数据库。

最常见的博客软件包可能是 Wordpress,它是数据库支持的、动态的,并且是用 php 编写的。它的许多主题可能是 html5 或至少具有一些前瞻性元素。我会说从那里开始,看看会导致什么。

关于php - HTML5分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9612577/

相关文章:

PHP:如何避免 foreach 中的重复结果?

php - 将 aukciono_id 从一张表转移到另一张表

javascript - JQuery 和 Underscore "each"保证数组的顺序?

PHP重定向到另一个网站

javascript - jQuery UI Slider - 根据选择而变化的自定义滑动按钮

php - oci_bind_by_name RETURNING INTO 截断值

php - SQL 简单连接问题

javascript - 使用用户输入来警告对象内的数组元素 (javascript)

html - 使一个 div 环绕另一个 div

php - 难以应用样式表