...

View Full Version : Adding space to php echo link



sackstein
10-22-2009, 01:17 AM
I am having trouble adding a space between two words in a php link.

here is my code:

<?php
if ( tep_session_is_registered('customer_id') ) {
echo '<a href="' . tep_href_link(FILENAME_LOGOFF) . '" class="toplinks">'. $customer_first_name . HEADER_TITLE_LOGOFF. '</a>';
}
else {
echo '<a href="' . tep_href_link(FILENAME_LOGIN) . '" class="toplinks">' . HEADER_TITLE_LOGIN. '</a>';
}
?>

So basically if the user with the first name Mike is logged in it displays MikeLogoff

what the ultimate goal is is to say Welcome Mike (logoff)

funnymoney
10-22-2009, 01:34 AM
this should do the trick

instead of your echo try



echo '<a href="' . tep_href_link(FILENAME_LOGOFF) . '" class="toplinks">'. $customer_first_name . HEADER_TITLE_LOGOFF. '</a> ';


it might look the same to you but notice the space after </a>

karlosio
10-22-2009, 03:18 AM
this should do the trick

instead of your echo try



echo '<a href="' . tep_href_link(FILENAME_LOGOFF) . '" class="toplinks">'. $customer_first_name . HEADER_TITLE_LOGOFF. '</a> ';


it might look the same to you but notice the space after </a>

Wouldn't that just do the same thing? If your wanting to separate the words you can put another space in between the customers first name and the logoff message like this.



echo '<a href="' . tep_href_link(FILENAME_LOGOFF) . '" class="toplinks">'. $customer_first_name . ' ' . HEADER_TITLE_LOGOFF. '</a>';

sackstein
10-22-2009, 05:02 PM
Thanks karlosio. That worked perfectly. And makes sense.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum