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; $isizeof($array)
{
$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?
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php