【问题标题】:expressionengine Channel Entries Tag in javascriptjavascript中的表达式引擎频道条目标签
【发布时间】:2012-08-24 22:58:26
【问题描述】:

首先对不起我的英语!我是法国人眨眼

我为一个使用 EE 的客户工作,但我遇到了一个小问题,因为我对表达式引擎很陌生

先有代码:

    <script type="text/javascript" src="http://www.superphysique.org/images/fancybox/jquery.cookie.js"></script>
    <script type="text/javascript">

    $(document).ready(function(){

    var check_cookie = $.cookie('the_cookie');

        if(check_cookie == null){
        $.cookie('the_cookie', 'the_value');
        $.fancybox(
                    '<p style="font-family:Tahoma; font-size:11px; color:#3B5998; font-weight:bold;">Cliquez maintenant sur J&#8217;aime pour recevoir mes conseils en temps réels !</p>
                                {exp:mailinglist:form list="mailebook"}
                                        <p>Join our Mailing List</p>
                                        <p><input type="text" name="email" value="{email}"></p>
                                        <p><input type="submit" value="submit"></p>
                                {/exp:mailinglist:form}',

                    {
                            'autoDimensions'    : false,
                            'scrolling'         : 'no',
                        'width'                 : 450,
                        'height'                : 570,
                        'transitionIn'      : 'none',
                        'transitionOut'     : 'none'
                    }
                    );
    }

     });

    </script>

我的客户希望在页面加载时在邮件列表订阅中打开一次fancybox。所以cookie没有问题,我也创建了邮件数据库。

但是当我把这个频道条目标签放在我的代码上时:

         {exp:mailinglist:form list="mailebook"}
                                        <p>Join our Mailing List</p>
                                        <p><input type="text" name="email" value="{email}"></p>
                                        <p><input type="submit" value="submit"></p>
                                {/exp:mailinglist:form}

fancybox 没有正确显示。

有人可以帮我解决这个问题吗?

谢谢!

【问题讨论】:

  • 源代码在渲染后是什么样子的?你的 EE 标签根本没有被解析吗?

标签: javascript tags expressionengine channel


【解决方案1】:

我几乎可以肯定,您永远无法在 JavaScript 中实现该功能(如果它是 JS 文件/模板)。变量和基本条件以及核心 EE 标记被处理,但不是这样的标记对。我通过使用嵌入解决了完全相同的问题...

{if logged_out}
    //###   Prompt for login when visitor tries to access member only features   ###
    var modalContent = '{embed=members/login-prompt language="en"}';
    ...
    etc

这表明基本 EE 条件 {if logged_out}{embed=...} 有效。

更多关于嵌入的信息可以在这里阅读:http://expressionengine.com/user_guide/templates/embedding.html

【讨论】:

  • 感谢您的回复!我将模块邮件列表管理器与 EE 2.2.2 一起使用。我将尝试将模块的标记代码嵌入模板中,并在我的 js 中尝试
【解决方案2】:

您是否可能需要protect_javascript = "no" 配置变量?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-05
    • 1970-01-01
    • 2012-08-03
    • 2011-11-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多