msfaria
(Santos Faria)
May 30, 2011, 4:19am
1
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?
msfaria
(Santos Faria)
May 30, 2011, 5:40pm
2
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.
mdomba
(Maurizio Domba Cerin)
May 31, 2011, 9:43am
3
I haven’t studied the FB button… but what is the pure HTML code that would work ?
msfaria
(Santos Faria)
May 31, 2011, 1:31pm
4
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.
gusnips
(Gustavo)
May 31, 2011, 1:40pm
5
<fb:like href="<?php echo Yii::app()->createAbsoluteUrl('/',array('pages'=>$page->url)));?>"
msfaria
(Santos Faria)
June 1, 2011, 3:08am
6
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!