[PHPTAL] tal:content with php:
Laurent Bedubourg
lbedubourg at motion-twin.com
Thu May 3 14:06:39 CEST 2007
James McLean wrote:
> Howdy,
>
> Using a PHP tales expression to generate a dropdown list, however
> every time it executes its returning incorrectly.
>
> The PHPTal is:
>
> <select name="product[discounted]">
>
> <span tal:omit-tag="" tal:condition="exists:
> productdetail/productdiscounted">
> <option value="0"
> selected="selected"
> tal:attributes="value productdetail/productdiscounted"
> tal:content="php: (productdetail.productdiscounted eq '1') ?
> 'Yes' : 'No' "
> ></option>
> <option>----</option>
> </span>
> <option value="0">No</option>
> <option value="1">Yes</option>
> </select>
>
> Regardless of what the value of 'productdetail.productdiscounted' is,
> it always prints 'No' in the drop down.
> productdetail.productdiscounted will return '0' if the product is not
> discounted, and '1' if the product is discounted.
If productdetail.productdiscounted is a method you have to call it in
php mode :
php: productdetail.productdiscounted() ? 'Yes' : 'No'
Regards
Laurent
--
Laurent Bedubourg
lbedubourg at motion-twin.com
http://www.motion-twin.com
More information about the PHPTAL
mailing list