Jump to content

Recommended Posts

hi - i have a series of links at the bottom of my website...generated by the following code...

<p class="footer_toolbar_links">
	<?php
		foreach($menu as $item) {
    			
    				echo " | <a href=\"{$item->value}\">" . $item->name . "</a>";
    			
		} 

	?>
	|
	</p>

 

This then creates a list of menu items at the bottom of the page...

 

in this case those links are: " | Friends | Latest activity | Files | Pages |

Blogs | Groups | Latest discussion | etc..."

 

I want to add another link to the end of those, but to an external website (a forum)

 

what would the php be to add this to the end?

 

like i say this is probably very basic stuff...i've tried adding the following code:

 

 <?php echo " | <a href=\"http://www.externallink.com">External Link</a>; ?>

 

but it didn't work...any suggestions?

 

this is needed very urgently so any help or suggestions would be greatly appreciated..

 

thanks

 

chris

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/145303-probably-a-realllllly-easy-question-but/
Share on other sites

<p class="footer_toolbar_links">
      <?php
         foreach($menu as $item) {
             
                echo " | <a href=\"{$item->value}\">" . $item->name . "</a>";
             
         } 

          echo " | <a href=\"http://www.externallink.com\">External Link</a>";
         
      ?>
      
      </p>

You can also use single quotes as your string delimiter instead of double ones, so:

 

<?php echo ' | <a href="http://www.externallink.com">External Link</a>'; ?>

 

Which means you can format your HTML with the usual double quotes and you don't need to keep escaping things :)

 

See string literals manual for further ref - http://uk3.php.net/types.string

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.