0
{exp:channel:entries dynamic="yes" limit="1"}
   // some code
{/exp:channel:entries}

Dynamic がオンに設定されているため、url_title が URL の最後のセグメントとして存在するエントリが表示されます。すべて正常に動作しています。

url_title が 'index_page' のインデックス ページも (チャンネル エントリとして) 持っています。しかし、この最後の URL セグメントが存在しなくても、デフォルトでこのページが表示されるようにしたいと考えています。次のような方法はありますか:

{exp:channel:entries dynamic="yes" default_url_title="index_page" limit="1"}
  // some code
{/exp:channel:entries}

これを無駄にグーグルで検索するのに最後の1時間を費やしました!

ありがとう。

4

3 に答える 3

0

埋め込みを使用しますか?

1 番目のテンプレート (これは、url_title を介して通常のページをキャプチャします。

{exp:channel:entries dynamic="yes" require_entry="yes" limit="1"}
    {if no_results}
        {embed:template-group/template}
    {/if}

   // some code
{/exp:channel:entries}

2 番目のテンプレート - template-group/template (これは index_page をキャプチャします):

{exp:channel:entries dynamic="no" url_title="index_page"}
   // some code
{/exp:channel:entries}
于 2013-08-23T20:11:29.247 に答える