使用条件嵌入模板

时间:2013-06-06 13:47:24

标签: expressionengine

我有一个基本的表达式模板,我用它来显示2个不同频道的条目。我使用嵌入在模板中心传递不同的页面布局,这是基于条件。

{exp:channel:entries channel="dog|cat" limit="1" dynamic="yes"}
  (basic html here)
    {if channel == "dog"}
      {embed="tg/one"}
    {if:elseif channel == "cat"}
      {embed="tg/two"}
    {/if}
  (some basic html here)
{/exp:channel:entries}

我也尝试过使用..

{exp:channel:entries channel="dog|cat" limit="1" dynamic="yes"}
  (basic html here)
    {if category_id == "100"}
      {embed="tg/one"}
    {if:elseif category_id == "200"}
      {embed="tg/two"}
    {/if}
  (some basic html here)
{/exp:channel:entries}

加载最终页面时,父模板显示正常,但没有显示相应的嵌入或任何嵌入。

值得注意的是,嵌入不包含任何表达式引擎代码,只是html。有人可以解释一下我做错了什么或最好的方法来实现这个目标吗?

由于

0 个答案:

没有答案