如何将标签添加到我现有的非 cms 网站?

发布于 2024-10-20 07:59:22 字数 704 浏览 4 评论 0原文

有一天,我嫉妒地看着支持 CMS 的 WordPress 网站拥有的所有功能,然后我意识到我错过了一件事情:标记。

在此处输入图像描述

有什么方法可以在我的非 cms、非数据库平面文件 php 上拥有这样的东西吗?网站?这基本上是一堆网页文件,例如 home.phpcontact.phpsomepage1.phpsomepage2.php

这实际上可能吗?

在想这样的事情:

  • 每个页面都包含tagsys.php
  • 每个页面都有带有一些标签的页脚bananapeachtomato
  • 超链接分别指向 /tags/banana/tags/peach >, /tags/tomato
  • 由于没有香蕉/桃子/番茄等实际文件,因此包含的 tagsys.php 必须知道如何排序生成一个新页面,其中捕获带有该标签的每个页面的本质($title 和 $descr),因此所有内容都可以自动化。

I was looking other day jealously at all the features that CMS-enabled WordPress sites have, and I realised one thing that I've missed out: tagging.

enter image description here

Is there any way I can have such a thing on my non-cms, non-database flat files php website? Which is basically bunch of web page files like home.php, contact.php, somepage1.php, somepage2.php, etc.

is this actually possible at all?

I was thinking of something like this:

  • each page includes tagsys.php
  • each page has footer with some tags banana, peach, tomato
  • the hyperlinks go respectively to /tags/banana, /tags/peach, /tags/tomato
  • since there are no actual files as banana / peach / tomato, the tagsys.php which is included, has to know how to sort of generate a new page, in which it captures the essence ($title and $descr) of every page with that tag, and so all could be automated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贩梦商人 2024-10-27 07:59:22

您还可以向每个页面添加一个 id(可能是文件名,您可以使用 php 获取: http://www.expertcore.org/viewtopic.php?f=67&p=1453)

然后在数据库存储中创建一个包含标签列表的表和另一个要创建的表页面 ID 和标签之间的关系。

通过这种方式,您将能够轻松创建一种“标签管理界面”。

但正如 Brent Friar 所说,如果可能的话,更愿意升级到现有的 cms,它非常快速且简单,并且会节省您的维护时间!

You could also add an id to each page (it may be the filename, wich you can get using php : http://www.expertcore.org/viewtopic.php?f=67&p=1453)

Then in your DB store create a table with a list of tags and another one to create a relation between your pages IDs and the tags.

In this way you will be able to create a kind of "tag administration interface" easily.

But as Brent Friar said, if possible, prefer upgrading to an existing cms, it's quite fast and easy, and it'll save you hours of maintenance!

陌上青苔 2024-10-27 07:59:22

只需将您的网站升级到任意数量的支持标记的 CMS,就会变得更容易、更快、更轻松。即使您的网站有数百页,将其移动到 Wordpress 也不难(尽管我会使用更复杂的 CMS,WP 是一个易于使用的优质产品)。

请记住,在静态站点上,每次创建新页面时都必须更新标签关联。这将是一场行政噩梦。

It would be a lot easier, faster, and less headache to simply upgrade your website to any number of CMSs that support tagging. Even if your site has several hundred pages it would not be hard to move it to Wordpress (though I would use a more sophisticated CMS, WP is a fine product that is easy to use).

Keep in mind that on a static site you are going to have to update the tag associations every time you create a new page. It would be an administrative nightmare.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文