PHP concatenation problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

PHP concatenation problem

Post by someguyhere »

I think this is a concatenation problem...below is my code (used inside Wordpress) but the echo spits out the variable in front of the opening </li>. Am I doing something wrong here?

Code: Select all

					if ( isset ( $fbloop ) && $fbloop ) {
						echo '<li class="facebook"><div class="fb-like" data-href="' . the_permalink() . '" data-send="false" data-layout="button_count" data-width="47" data-show-faces="false" data-font="arial"></div></li>';
					}
Here is the output:
http://spartanmedia.com/use-twitter-like-pro/<li class="facebook"><div class="fb-like" data-href="" data-send="false" data-layout="button_count" data-width="47" data-show-faces="false" data-font="arial"></div></li>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP concatenation problem

Post by Celauran »

WordPress functions echo instead of returning half the time. Try using get_permalink instead of the_permalink.
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: PHP concatenation problem

Post by someguyhere »

Perfect. Thanks!
Post Reply