首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Expressionengine if语句销毁代码

Expressionengine if语句销毁代码
EN

Stack Overflow用户
提问于 2011-11-01 03:28:50
回答 3查看 584关注 0票数 0

我终于(我想)用ExpressionEngine的多语言替代维基实现了第二种语言。

我遇到的问题是,当我尝试添加以下if语句(或其他语句)时

代码语言:javascript
复制
{if country_code == “fr”} {/if}

在我原本很好的导航标签周围,整个页面都被破坏了。在查看源代码时,添加if语句会删除该语句前后的大量代码。

它删除了语句前后的结束标记,有效地将页面发送到各处。

有人知道为什么会这样吗?

编辑:这是完整的代码:

代码语言:javascript
复制
<div id="top_links">

            <ul id="top_links_list">

                <li>t: +33 (0)467 45 90 00</li>
                <li>e: <a href="mailto:#>Email</a></li>



                {if segment_1 == "hotel" OR segment_1 == "contact"}
                    <li class="hotel_reserve">
                        <a href="#" target="_blank">{if country_code == "fr"}Réservez votre séjour{/if}{if country_code == "en"}Reserve your stay{/if}</a>
                    </li>
                {/if}

                {if segment_1 == "restaurants" AND segment_2 !="reservations" AND segment_2 !="merci"}
                    <li class="restaurants_reserve">
                        <a href="{path="restaurants/reservations"}">{if country_code == "fr"}Réservez votre table{/if}{if country_code == "en"}Reserve your table{/if}</a>
                    </li>
                {/if}

                {if segment_1 == "golf" AND segment_2 !="reservations" AND segment_2 !="merci"}
                    <li class="golf_reserve">
                        <a href="{path="golf/reservations"}">{if country_code == "fr"}Réservez votre départ{/if}{if country_code == "en"}Reserve your tee-time{/if}</a>
                    </li>
                {/if}

                {if segment_1 == "evenements" AND segment_2 !="reservations" AND segment_2 !="merci"}
                    <li class="evenements_reserve">
                        <a href="{path="evenements/reservations"}">{if country_code == "fr"}Demandez un devis{/if}{if country_code == "en"}Get a quote{/if}</a>
                    </li>
                {/if}

                {if segment_1 == "competitions" AND segment_2 == "view"}
                    <li class="competitions_retour">
                        <a href="{path="competitions"}">{if country_code == "fr"}Retour au page compétitions{/if}{if country_code == "en"}Return to competitions page{/if}</a>
                    </li>
                {/if}

                {if segment_1 == "competitions" AND segment_2 == "merci"}
                    <li class="competitions_retour">
                        <a href="{path="{segment_1}"}">Retour au page {segment_1}</a>
                    </li>
                {/if}

                {if segment_1 == "golf" AND segment_2 == "merci"}
                    <li class="competitions_retour">
                        <a href="{path="{segment_1}"}">Retour au page {segment_1}</a>
                    </li>
                {/if}

                {if segment_1 == "restaurants" AND segment_2 == "merci"}
                    <li class="restaurants_reserve">
                        <a href="{path="{segment_1}"}">Retour au page {segment_1}</a>
                    </li>
                {/if}

                {if segment_1 == "evenements" AND segment_2 == "merci"}
                    <li class="evenements_reserve">
                        <a href="{path="{segment_1}"}">Retour au page {segment_1}</a>
                    </li>
                {/if}

                {if segment_1 == "merci"}
                    <li class="evenements_reserve">
                        <a href="{path="contact"}">Retour au page contact</a>
                    </li>
                {/if}

                {if segment_1 == "events" AND segment_2 == "view"}
                    <li class="evenements_reserve">
                        <a href="{path="events"}">Retour au page Events</a>
                    </li>
                {/if}

            </ul>


        </div> <!-- end top links -->   

            {if country_code == "fr"}
        {exp:navee:nav nav_title="main_nav" id="nav" parent_selected_class="parent_selected" selected_class_on_parents="true"}
             {/if}

    </div> <!-- end top right area -->

    <div class="clear"></div>

    </div> <!-- END TOP AREA -->

谢谢。

EN

回答 3

Stack Overflow用户

发布于 2011-11-02 16:31:11

在你的情况下,我可能会使用Switchee,这比大量的if条件要好得多。

票数 1
EN

Stack Overflow用户

发布于 2011-11-01 03:33:00

你的源代码似乎有花哨的引号:

代码语言:javascript
复制
{if country_code == “fr”} {/if}
{if country_code == "fr"} {/if}

看到区别了吗?试试第二行。

票数 0
EN

Stack Overflow用户

发布于 2011-11-01 03:35:31

您需要确保遵守目录列表规则,并且已经创建了所有目录以及匹配的文件夹和规则referenced

将您的代码更改为:

代码语言:javascript
复制
<h2 class="title">{if country_code= "fr"} Bonjour !{/if}</h2>  

请注意,引号是"“而不是”“,并且没有双==

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7958672

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档