We are using smarty as template system for one of our form, please check add/edit form code...
<form action="{$MAIN_URL}products/add" method="post" class="clearfix">
<input type="text" name="cname" value="{if $smarty.post.cname}{$smarty.post.cname}{elseif $editdetails.product_name}{$editdetails.product_name}{/if}" />
its throwing following error...
Undefined variable: post in <b>/root/smarty/libs/sysplugins/smarty_internal_data.php</b> on line 291
It works fine if we remove {if $smarty.post.cname}{$smarty.post.cname}
please help to fix. thanks.
I think it should be
{if isset($smarty.post) && isset($smarty.post.cname)}
but for the sake of brevity, this should work
{if isset($smarty.post.cname)}{$smarty.post.cname}{elseif $editdetails.product_name}{$editdetails.product_name}{/if}
Rather than {$smarty.post.cname}
, is your variable actually called {$post.cname}
? You other {$editdetails}
would seem to imply that.
This assumes that $smarty
is the PHP Smarty object variable, and not a template variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.