Questions to loop and array

From: Date: Fri, 14 Nov 2003 11:47:48 +0000
Subject: Questions to loop and array
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10537@lists.php.net to get a copy of this message
Hi Ng, What do I have to do, so that loop indicates the data from the array to me? I read a VirtualHost with Pear::Config from httpd.conf And store these with Php::Config in an array. $settingsSection =& $content->getItem("section", "VirtualHost"); $Vhost = $settingsSection->toArray('phparray', array('name' => 'Virtual')); $smarty->assign( "servers", $Vhost); $smarty->display('index.tpl'); The array has the following contents: array(1) { ["VirtualHost"]=> array(4) { ["@"]=> array(1) { [0]=> string(12) "127.0.0.1:80" } ["DocumentRoot"]=> string(14) "/usr/share/www" ["ServerName"]=> string(15) "www.test.com" ["Location"]=> array(2) { [0]=> array(3) { ["@"]=> array(1) { [0]=> string(5) "/test" } ["AuthType"]=> string(5) "basic" ["Require"]=> string(11) "group admin" } [1]=> array(3) { ["@"]=> array(1) { [0]=> string(6) "/admin" } ["AuthType"]=> string(5) "basic" ["Require"]=> string(12) "group stefan" } } } } Index.tpl looks as follows. ~snip {section name=server loop=$servers} <TR> <TD VALIGN=TOP BGCOLOR=#D9E1E8 NOWRAP> <A HREF="viewserver.php?servername={$servers[server].ServerName}" TITLE="View virtual server details"><IMG SRC="gfx/zoom.gif" BORDER=0> </A> <A HREF="editserver.php?servername={$servers[server].servername}" TITLE="Edit virtual server"><IMG SRC="gfx/edit.gif" BORDER=0></A> {$servers[server].servername}</TD> ~snap Please someone can explain to me exactly, how I get array to the individual elements read. Thanks for each assistance Cheers Stefan

« previous php.smarty.general (#10537) next »