以编程方式向 Concrete5 添加页面必须执行的一系列 mySQL 语句是什么?

发布于 2024-10-03 06:11:54 字数 198 浏览 5 评论 0原文

我希望在具体的 CMS 中创建内容,然后定期替换内容。

我已经确定了 15 个表,这些表在添加新页面时会发生更改(通过执行 MYSQL diff)。

但是我不太了解这些表如何获取它们的值,尤其是 btcontentlocal 中的 bID 值。

我今天才发现crete5,所以如果你知道有一个API可以将内容发布到后端,请也与我分享!

I wish to create then periodically replace content in a concrete5 CMS.

I have identified 15 tables which are changed when a new page is added (by doing an MYSQL diff).

However I dont quite follow how these tables are getting their values, especially the bID value in btcontentlocal.

I only discovered concrete5 today, so if you know that there is an API to post content to the backend, please share that with me too!

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

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

发布评论

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

评论(2

抠脚大汉 2024-10-10 06:11:54

Concrete5 通常不会“替换”内容——相反,它会为页面的历史添加新的修订(请注意,由于历史原因,页面通常在代码和数据库中被称为“集合”——如“块的集合”)。 bID 是块 ID,每次编辑块时都会更改(同样,因为它实际上并不是在编辑现有的块,而是将该块复制到新块,以便旧块保留在修订历史记录中) 。

所以......不确定你到底想做什么,但是如果你想更新页面上的内容块,你需要创建一个新的集合版本(我相信它隐式地向前推进所有现有的块),然后复制问题块中的块(我认为块模型中有一个“复制”或“克隆”方法用于此目的),然后更新该块的内容,然后从新集合版本中取消分配旧块,然后分配新区块到新的集合版本,然后批准/发布新的集合版本。

我强烈建议不要通过数据库查询来完成此操作——Concrete5 是一个非常复杂的系统,并且有很多小事情正在发生,您不想意外地遗漏在这个过程中。更好的方法是通过模型本身找出如何做到这一点。不幸的是,我认为没有一个简单的 API 函数可以完成所有这些工作——相反,您需要弄清楚需要完成的 5 或 6 件不同的事情。如果您在crete5 论坛上提出这个问题,您可能会更幸运:
http://www.concrete5.org/community/forums/customizing_c5/

Concrete5 doesn't usually "replace" content -- rather, it adds a new revision to the history of a page (note that due to historical reasons, a page is often called a "collection" in the code and database -- as in "a collection of blocks"). The bID is the block id, which will change every time a block is edited (again, because it's not actually editing the block that was there, but rather copying that block to a new one so the old one sticks around for the revision history).

So... not sure what exactly you're trying to do, but if you want to update a content block that's on a page, you need to create a new collection version (which I believe implicitly carries all existing blocks forward), then copy the block in question block (I think there's a "copy" or "clone" method in the block model for this purpose), then update that block's content, then un-assign the old block from the new collection version, then assign the new block to the new collection version, then approve/publish the new collection version.

I would strongly advise against doing this via database queries -- Concrete5 is a very complex system and there are lots of little things going on that you don't want to accidentally leave out of the process. The better approach is to figure out how to do it through the models themselves. Unfortunately I don't think there's one simple API function for doing all this, though -- instead you'll need to figure out the 5 or 6 different things that need to be done. You might have more luck if you ask this question on the concrete5 forums:
http://www.concrete5.org/community/forums/customizing_c5/

堇年纸鸢 2024-10-10 06:11:54

请参阅此文档。 http://www.concrete5.org/documentation/developers/pages/overview

您可以使用C5自身的代码添加页面;)

See this documentation. http://www.concrete5.org/documentation/developers/pages/overview

You can add pages by using code of C5 self;)

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