[Phplib-trackers] [ phplib-Bugs-593846 ] value of a variable can't be '0'
Brought to you by:
nhruby,
richardarcher
|
From: <no...@so...> - 2002-08-12 01:53:17
|
Bugs item #593846, was opened at 2002-08-11 19:29 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403611&aid=593846&group_id=31885 Category: Template Group: 7.2.x Status: Open Resolution: None Priority: 5 Submitted By: Mickael Bailly (dready) Assigned to: Nobody/Anonymous (nobody) Summary: value of a variable can't be '0' Initial Comment: I got a template variable FILE_NB which can be equal to the string 0 . But template function evaluate 0 as null and so gives me an error: <b>Template Error:</b> loadfile: FILE_NB is not a valid handle.<br> Test with this script to see the problem: require 'template.inc'; $t = new template('/tmp'); //no matter what page.tpl contains $t->set_file('page','page.tpl'); $t->set_var('FILE_NB','0'); $t->parse('out',array('FILE_NB','page')); Suggested modification: on the first line of the loadfile function, replace the test: !empty($this->varvals[$handle]) with strlen($this->varvals[$handle]) ---------------------------------------------------------------------- Comment By: Joe Stewart (joestewart) Date: 2002-08-11 20:53 Message: Logged In: YES user_id=77269 The error says that FILE_NB is not a valid handle. Try this instead: $t->parse('out','page'); parse syntax: parse($target, $varname, $append = false) where $varname is defined in set_file for your example as 'page'. set_file($varname, $filename = "") See documentation: http://www.sanisoft.com/phplib/manual/templateMethods.php#templateMethodsInt 0 is substitiuted into templates many many times. hth, Joe ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403611&aid=593846&group_id=31885 |