On 3 Jun 2009, at 12:04, Szymon Przybył wrote:

I have write a function to check whether input in form was checked (in case of mistake in form) - if there exists post array (previously I add: if(isset($_POST)) $tal->post = $_POST;) it search there if input was checked:

  public function isChecked($path, $value) {
            if(!isset($this->tal->post))
          return FALSE;


<input type="radio" name="account[gender]" value="male" style="width:auto" tal:attributes="checked php:isChecked('account/ gender', 'male')"/> Male

But it throws error:


*Fatal error*: Call to undefined function isChecked() in */home/ szymon/domains/estender.net/public_html/swiatpracy/application/ libraries/PHPTAL.php(564) : eval()'d code* on line *124

*So how can I use this function?

The function you've cited above seems to be a method of some class (uses $this), but in the template you're trying to use it as a standalone function, without any object.

You need to pass object to template that has isChecked method and use it as a method, or move isChecked function outside class and use something else instead of $this.

--
regards, Kornel


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to