Jump to content

Print or echo multipule arrays


tomfmason

Recommended Posts

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 reasons

here 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 information

What 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.