All pastes #168239 Raw Edit

Mine

public text v1 · immutable
·published 2006-09-12 20:44 UTC
rendered paste body
	// This method below I have complete access to the array parts. But it does 
	// no loop correctly in smarty. 
	
	$main_array = Array(
						"Miscellaneous" => Array("Backup" => "backup.php", "Words" => "words.php"),
						"Forums" => Array("Community" => "forums.php"),
						"Downloads" => Array("Downloads" => "download.php?mode=dl", "Uploads" => "downloads.php?mode=upload", "Rate File" => "downloads.php?mode=rate"),
    					"User Management" => Array("View Users" => "users.php")
					);
	
	while( list($cat, $action_array) = each($main_array) )
	{
		
		$cats[] = array(
			"ADMIN_CATEGORY" => $cat, 
			"ADMIN_ACTION" => $action_array
		);
		
		$smarty->assign('catrow', $cats);
		
		while( list($action, $file)	= each($action_array) ) {
			
			$smarty_dump = array(
				"ADMIN_MODULE" => $action, 
				"U_ADMIN_MOD" => $file
				
			);
			
			$class_data[$i++] = $smarty_dump;
			$smarty->assign('modrow', $class_data);
		
		}
	}
	
	// The template looks like this.
	
		{foreach from=$catrow item=cats}
		{$cats.ADMIN_CATEGORY}
		{foreach from=$modrow item=mods}
			<a href="{$mods.U_ADMIN_MODULE}">{$mods.ADMIN_MODULE}</a>
		{/foreach}
	{/foreach}