Jump to content

probably a realllllly easy question but...


chrishide87

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.