gpt4 book ai didi

php - 如何访问文章中的模板颜色?

转载 作者:太空宇宙 更新时间:2023-11-04 12:45:11 25 4
gpt4 key购买 nike

我是 Joomla 的新手,使用 3.3.6 版和默认的 protostar 模板(基于 bootstrap)。我正在使用 Sourcerer plugin将 PHP 代码插入到我的文章中。

现在我想访问模板颜色来设置表格边框的样式。在 index.php 中,我可以只使用 $this->params->get('templateColor')。但是,在文章内部没有定义对象上下文。我看过 variables and objects that are defined in sourcerer .到目前为止没有成功。

或者是否有另一种(更好的)方法可以在编辑器中动态使用模板颜色?

最佳答案

使用下面的模板颜色代码

$app    = JFactory::getApplication();
$params = $app->getTemplate(true)->params;

$color = $params->get('templateColor');

关于php - 如何访问文章中的模板颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26561925/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com