Smarty and no cache for a page/part of page
I'm using a VLDPersonals script and it uses smarty for template system, no problem with that, however, I needed to add a notice page, where users have to click 'I understood' button, no problem with that, however, smarty decides to cache/compile the page, so when next user comes, they wont be able to click the button as the php POST handle would not fire... Current code is
<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>
I have tried to add {nocache} tags, didnt work, tried to define the nocache tag via some guide I found, didnt work, tried to flush cache, didnt work.. The smarty object is assigned to $TEMPLATE, anyone could help? Causing me headaches!
vldPersonals doesn't use Smarty, it uses their own custom coded templating engine. Though it's possible to use pure PHP code in .tpl files it's not recommended. I'd suggest to use php statements in corresponding lib file (for example lib.account_home.php for account/home/ page). Look at adult warning code as example in lib.member_pictures.php and member_pictures_view.tpl
I believe you could use the 'force_compile' setting.
$TEMPLATE->force_compile = true
精彩评论