0

我对 CMSMS 有一个非常奇怪的问题 - 为什么这是半成品:

<head>
{if $current_step=='2' or $current_step=='4'}
HEAD_ON
{else}
HEAD_FAIL
{/if}
</head>
{if $current_step=='2' or $current_step=='4'}
NEITHER_ONE_OK
{else}
NEITHER_ONE_FAIL
{/if}
<body>
{if $current_step=='2' or $current_step=='4'}
BODY_OK
{else}
BODY_FAIL
{/if}
</body>

回报:

HEAD_OK
NEITHER_ONE_FAIL
BODY_FAIL

我使用最新的 CMSMS 版本 - 1.9.3。CMSMS 基于 smarty,允许在 CMSMS UDT 部分执行此操作:

$gCms->smarty->assign('current_step',"".htmlspecialchars($_GET['step_id'])."");

我想如果 CMSMS 使用某种方法,首先解释正文部分,然后编译 UDT,然后编译整个网站,我想这个问题是可能的。

有什么解决办法吗?谢谢你。

4

3 回答 3

1

CMSMS 以几乎相反的顺序处理模板。

来自 1.4 的发行说明:http ://www.cmsmadesimple.org/cgblog/818/Announcing-CMS-Made-Simple-1-4-Jamaica/

* We split the template into three pieces
a) Any text ontop of 
b) The section
c) the rest of the template (the body)
于 2011-02-25T06:53:45.197 回答
1

是的,有一个解决方案。

您应该使用 smarty 捕获内容部分和其他调用,以使变量随处可用。

在模板顶部使用:

{capture assign='cc'}{content}{/capture}

并替换 {$cc} 的 {content} 标签

这样,在页面内容上的 UDT 调用中定义的任何变量,在处理头部之后,都将可用于模板的其余部分。

查看此旧指南以获取从身体到头部的一些变量,您将了解它是如何工作的:

http://forum.cmsmadesimple.org/viewtopic.php?f=4&t=30475&sid=ed7e25c50612eb9f052ec4bee16d782c

于 2012-01-25T02:46:33.693 回答
0

CMSMS 开发团队的回答:“CMSMS(默认情况下)首先处理上面的内容,然后是部分,然后是 head 部分,并在输出之前将结果粘合在一起。”

于 2011-04-06T09:41:53.650 回答