“链接”的最佳方式两个网页

发布于 2024-08-19 13:29:01 字数 114 浏览 4 评论 0原文

我计划制作两个处理类似主题的网页(不同的域)。在第一页上会发布文章,我想在另一页上也显示这些文章(例如,这里仅显示最后 10 篇文章)。实现这一点的最佳方法是什么?

编辑:我使用 php/mysql

I was planing to make two web pages (different domains) which deal with similar subject. On the first page there would be published articles and I would like to show those articles on the other page also (here would be displayed for example only last 10 articles). What is the best way to realize this?

EDIT: I use php/mysql

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

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

发布评论

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

评论(4

a√萤火虫的光℡ 2024-08-26 13:29:01

您应该将您的文章存储在两个页面都可用的数据库中(它们在同一个网络服务器上吗?)

然后在一个页面上您可以执行以下操作:

SELECT title, summary FROM articles ORDER BY date DESC

而在另一个页面上:

SELECT title, fulltext FROM articles ORDER BY date DESC LIMIT 10

您可以从同一个网络服务器提供两个网页,即使域名不同。

You should store your articles in a database which is available from both pages (are they on the same webserver?)

Then on one page you could do this:

SELECT title, summary FROM articles ORDER BY date DESC

and on the other:

SELECT title, fulltext FROM articles ORDER BY date DESC LIMIT 10

You can serve both web pages from the same webserver even if the domain names are different.

我家小可爱 2024-08-26 13:29:01

听起来您没有将两个页面“链接”在一起,而是呈现相同数据的两个不同视图 - 第一页显示完整的文章,第二页可能仅显示最后 10 篇文章的标题。

Sounds like you're not "linking" the two pages together, you're presenting two different views of the same data - the first page shows the full articles, the second page shows perhaps titles only of the last 10 articles.

陈甜 2024-08-26 13:29:01

如果两个站点无法访问同一数据库,则必须为第一个站点提供某种 API,以 XML、JSON 等形式导出最后 10 篇文章,并将其包含到第二个站点中。

If both sites don't have access to the same database, you have to provide some kind of API for your first site that exports the last 10 articles in XML, JSON, whatever and include this into your second site.

与酒说心事 2024-08-26 13:29:01

如果您无法在 2 个不同站点使用相同的数据库,您还可以创建最后 10 篇文章的 rss feed(或类似的),并使用它来显示其他站点上的文章!

If you don't have the possibility to use the same database from the 2 different sites, you could also create a rss feed (or similar) of the 10 last articles, and use that to display the articles on the other site!

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