0

我通过使用以下方法创建文件( override/classes/controller/FrontController.php )为我的 PrestaShop 创建了一些自定义简码:

public static function parseCMSContent($content)
{
...
}

在我的模块和 cms smarty 模板中,我更改了:

{$cms.content nofilter}

至:

{FrontController::parseCMSContent($cms.content) nofilter}

Prestashop 1.7.7.5 一切正常,但对 1.7.8.2 的更新破坏了整个过程。

我收到一个 500 错误说:

PHP Fatal error: Uncaught Error: Call to undefined method FrontController::parseCMSContent() ... .module.pscustomtextpscustomtext. ...

虽然启用了调试模式,但它仍然可以正常工作..

我找不到有关已弃用的功能的任何信息,请知道如何让它再次工作?

4

1 回答 1

1

如果这可以帮助任何人,我通过将我的覆盖移动到一个新的 smarty 插件来解决这个问题。

我创建了一个文件vendor/smarty/smarty/libs/plugins/function.get_shortcoded_content.php

我在以下位置添加了我的简码:

function smarty_function_get_shortcoded_content($params, &$smarty)
{
...
}

在我的 smarty 文件中,我调用了:

{get_shortcoded_content content=$cms.content}

代替:

{$cms.content nofilter}

它似乎又可以正常工作了。

于 2022-01-21T11:01:41.310 回答