PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_Template_Flexy » Bug #5899

Assigning a string array don't work

Details

Submitted2005-11-08 17:59 UTC
Fromptitdoc at free dot fr
StatusNo Feedback
PackageHTML_Template_Flexy
PHP Version5.0.5
OSArch linux
Roadmaps(Not assigned)

Comments

[2005-11-08 17:59 UTC] ptitdoc at free dot fr

Description:
------------
In the output {title} is not set.
When I make a print_r($flexy); $flexy->assign is set but no values for variables or references.

Please note that I use another driver than these provided, but I don't thing it's a driver specific bug.

I have fixed it by changing the line 123 of Assign.php from :
$this->assign($key, $val);
to :
$this->assign(array($key, $val));

Shouldn't assign API be more complete ?
For example the attribute API used by Agavi (A MVC framework) is :

abstract function setAttribute ($name, $value);
abstract function appendAttribute($name, $value);
abstract function setAttributeByRef ($name, &$value);
abstract function appendAttributeByRef($name, &$value);
abstract function setAttributes ($values);
abstract function setAttributesByRef (&$values);
abstract function & removeAttribute ($name);
abstract function getAttributeNames ();
abstract function & getAttribute ($name);
abstract function hasAttribute ($name);
abstract function clearAttributes ();

(I have done it if needed...)

Test script:
---------------
$flexy = new HTML_Template_Flexy($this->options);

$vars['title'] = "My Great Title";
$vars['foo'] = "Bar";

$flexy->compile("foo.tpl");
$flexy->setData($vars);
$flexy->output();

Expected result:
----------------
Variable $title or $foo have values in the template.

Actual result:
--------------
Variables $title and $foo are not set.