【问题标题】:Smarty and no cache for a page/part of pageSmarty,页面/部分页面没有缓存
【发布时间】:2011-09-13 19:39:28
【问题描述】:

我正在使用 VLDPersonals 脚本,它使用 smarty 作为模板系统,没有问题,但是,我需要添加一个通知页面,用户必须点击“我理解”按钮,没有问题,但是, smarty 决定缓存/编译页面,所以当下一个用户来时,他们将无法单击按钮,因为 php POST 句柄不会触发...当前代码是

<div class="entry">
            <?php
            if(isset($_POST['understand'])) {
                $conn = mysql_connect('localhost', 'user', 'password');
                mysql_select_db("table", $conn);
                mysql_query("sql..");

            }
            ?> 
                <p>Notice text</p>
                <form action="" method="post">
                    <input type="submit" value="I Understand!" name="understand" />
                </form>
            </div>

我尝试添加 {nocache} 标记,没有用,尝试通过我找到的一些指南定义 nocache 标记,没有用,尝试刷新缓存,没有用.. smarty 对象分配给 $TEMPLATE,任何人有帮助?让我头疼!

【问题讨论】:

    标签: php mysql smarty


    【解决方案1】:

    vldPersonals 不使用 Smarty,它使用自己的自定义编码模板引擎。 尽管可以在 .tpl 文件中使用纯 PHP 代码,但不建议这样做。 我建议在相应的 lib 文件中使用 php 语句(例如 lib.account_home.php 用于 account/home/ 页面)。以 lib.member_pictures.php 和 member_pictures_view.tpl 中的成人警告代码为例

    【讨论】:

      【解决方案2】:

      我相信您可以使用“force_compile”设置。

      $TEMPLATE->force_compile = true
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-02-10
        • 2011-08-14
        • 1970-01-01
        • 2013-11-05
        • 2016-09-16
        • 2014-04-28
        • 2016-08-03
        • 2014-03-14
        相关资源
        最近更新 更多