Yii + New Facebook Send Button

Hi there!

I’m new to Yii and I’m having a little problem making a way to integrate the new Facebook Send Button on my website. The share button uses:




<?php echo CHtml::link('Facebook'),'http://www.facebook.com/share.php?u='.htmlspecialchars(aUrl('/',array('pages'=>$page->url))), array('target'=>'_blank', 'class' => 'facebook'));?>



Which did work, but now was deprecated by the new Send button. But now I can’t make it work properly - it prints the url code on the page instead of making a custom Send + like button for each page:




<div id="fb-root"></div>

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>

<fb:like href="<?php echo CHtml::link('', aUrl('/',array('pages'=>$page->url)));?>" send="true" layout="button_count" width="450" show_faces="false" font="arial"></fb:like>



How can I make it work properly?

Anyone can help on this? I know that the code


<fb:like href="<?php echo CHtml::link('', aUrl('/',array('pages'=>$page->url)));?>"

is wrong, but I don’t know how to combine CHtml::link with the href needed by FB like code to render the like button for the proper page.

I haven’t studied the FB button… but what is the pure HTML code that would work ?

This one, for example:


<fb:like href="www.mywebsite.com/pages/url2" send="true" layout="button_count" width="450" show_faces="false" font="arial"></fb:like>

I need the button to like / send the page the user is currently in - but obviously the code I tried to make isn’t working.


<fb:like href="<?php echo Yii::app()->createAbsoluteUrl('/',array('pages'=>$page->url)));?>"

Gustavo, it didn’t work, but sent me on the right direction:


<fb:like href="<?php echo aUrl('/',array('pages'=>$page->url));?>" send="true" layout="button_count" width="450" show_faces="false" font="arial"></fb:like>

And now it’s working! :D