Re: Passing objects as a reference and extracting the index of an associative array.
| From: | John W. Holmes | Date: | Thu, 04 Sep 2003 16:50:30 +0000 |
| Subject: | Re: Passing objects as a reference and extracting the index of an associative array. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161674@lists.php.net to get a copy of this message | ||
Webmaster wrote:
Hi, i am using the smarty template engine. Here is the problem that I would like to ask about: function initTop(&$page, $array) { for ($i=0; $i<sizeof($array) {There is no "assignVars" method within Smarty. Are you using something else overtop of it? You can assign the whole array to Smarty like this: $smarty->assign('some_name',$some_array); Then, say you have $some_array['one'] = "Bob", you'd use a placeholder like {$some_name.one} to get the value "Bob" in your template. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com$page->assignVars(, $array[$i])} } The function is supposed to know which object's attributes she is supposed to change. Do I have to pass the object as a reference? Have never worked with References before. The array is supposed to be associative. The funcion assignVars() is called like this: $objektname->assignVars("indexname of ass. array", $arraywert); How do I get the indexname for each arrrayvalue, so I can pass it to the function assignVars?