Ticket #154 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

variable default value == function

Reported by: nightowl Assigned to: schst
Priority: Medium Milestone: v3.1
Component: patTemplate class Version: SVN-HEAD
Severity: normal Keywords:
Cc:

Description

is there a way to use a function in the "default" field of patTemplate:var ? I'd like to indicate "default = today" in a textbox...

Change History

03/05/06 17:31:49 changed by schst

  • owner changed from schst@php-tools.net to schst.
  • status changed from new to assigned.
  • severity changed from normal to enhancement.

This is not yet possible, but seems to be a nice feature.

I could implement something along the lines of <patTemplate:var name="foo" default="time()"/>

08/08/06 22:55:16 changed by schst

  • status changed from assigned to closed.
  • resolution set to fixed.

This has been implemented in changeset [438]

You need to enable this feature using:

$tmpl->setOption('allowFunctionsAsDefault', true);

If this option has been set, you may specify functions or static methods in the default-attribute of the var-tag:

<patTemplate:var name="current_time" default="time()"/>
<patTemplate:var name="foo" default="Foo::bar()"/>