tomfmason Posted July 3, 2006 Share Posted July 3, 2006 I have a multidirectional array and am wanting to echo or print multiple arrays at one time without having to repeat echo over and over again. here is an example of my array.php file. I am using a php file because I want to cut down on database queries, for speed reasonshere is an example of my array.php file[code] '$home' => array('$home_url', 'Home', 'The Home Of Owpt'); '$account' => array( '$main' => array('$account_url', 'My account', 'My account'); '$sub' => array( '$profile' => array( 'profile', 'Profile', 'Profile' ); '$messages' => array( 'account=messages', 'My Messages', 'My Messages' ); '$purchases' => array( '$account=purchases', 'My Purchases', 'My Purchases' ); '$downloads' => array( 'downloads', 'Downloads', 'Downloads' ); '$custom' => array( '$custom', 'Custom', 'Custom' ); ); ); '$support' => array( '$main' => array('$support_url', 'Support', 'Support'); '$sub' => array( '$live' => array( 'live', 'Live Support', 'Live Support' ); '$knowledge_base' => array( 'knowledge_base', 'Knowledge Base', 'Knowledge Base' ); 'support_tickets' => array( '$support_tickets', 'Support Tickets', 'Support Tickets' ); '$virtual_assitant' => array( '$virtual_assitant', 'Virtual Assitant', 'Virtual Assitant' ); '$faq' => array( 'faq', 'FAQ', 'FAQ' ); ); ):[/code]I am going to be using switch and I want to print/echo all of, say, the $main s into a format like this.[code]<li><a href="$link[0]" TITLE="$title[0]">$title[0]</a></li><li><a href="$link[1]" TITLE="$title[1]">$title[1]</a></li>[/code]Then I would have a different switch statement for when some one clicks on on one of the links. I am already using switch and only need to know how to display a set number of the variables. I am not wanting to manually echo each one. If that were the case I would just manually input the informationWhat I would like to do is define how many of the variables will be displayed in that format.Here is a link to my site so that you may get a better idea of what I am trying to do [url=http://www.owpt.biz/index.php]http://www.owpt.biz/index.php[/url] click on one of the links and you will see the navbar move. That is what I am try to achieve.It is the left navigation bar. It is manually coded right now and works. Link to comment https://forums.phpfreaks.com/topic/13588-print-or-echo-multipule-arrays/ Share on other sites More sharing options...
tomfmason Posted July 3, 2006 Author Share Posted July 3, 2006 some how when posting this the arrays got nocked out of postion. Link to comment https://forums.phpfreaks.com/topic/13588-print-or-echo-multipule-arrays/#findComment-52652 Share on other sites More sharing options...
kenrbnsn Posted July 3, 2006 Share Posted July 3, 2006 The code you show for your array is not valid.Please post the valid array. Put the code between [nobbc][php][/php][/nobbc] tags.Ken Link to comment https://forums.phpfreaks.com/topic/13588-print-or-echo-multipule-arrays/#findComment-52681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.