social

Insert twitter, googleplusone and facebook button
26 followers

Insert twitter, googleplusone and facebook button, accepting horizontal and vertical alignment.

Extension's code is XHTML valid.

Requirements

Tested with Yii 1.1.7

Install

  • Download the latest release package
  • Unpack it in /protected/extensions/ folder

Usage

Insert next code in your page, where do you want to place buttons.

<?php $this->widget('application.extensions.social.social', array(
    'style'=>'vertical', 
        'networks' => array(
        'twitter'=>array(
            'data-via'=>'', //http://twitter.com/#!/YourPageAccount if exists else leave empty
            ), 
        'googleplusone'=>array(
            "size"=>"medium",
            "annotation"=>"bubble",
        ), 
        'facebook'=>array(
            'href'=>'https://www.facebook.com/your_facebook_page',//asociate your page http://www.facebook.com/page 
            'action'=>'recommend',//recommend, like
            'colorscheme'=>'light',
            'width'=>'120px',
            )
        )
));?>

Usual parameters to be adjusted:

- style: button's alignment (string: horizontal or vertical).
- networks: social network which you must have (twitter, googleplusone, facebook);
- data-via:Your Twitter Page Account if exists or leave empty (url: //http://twitter.com/#!/YourPageAccount)
- size: google button size (string:small, standard, **medium**, tall)
- annotation: google button mode to show annotation(string: **bubble**, inline, none)
- href: Your Facebook Page (url: http://www.facebook.com/facebook_page)
- action: action for facebook button (string: **recommend** or like)
- colorscheme: used color scheme for facebook button (string: **light** or dark)
- width: the width for facebook button container (pixels: **120px**)

Resources

Total 6 comments

#7300 report it
Sampa at 2012/03/12 12:50pm
@MichelH

<?= works even with short tags off. I got suprised when I noticed, but its true:)

(I have short tags off on my localhost and use <?= all the time )

#6734 report it
alejofonseca at 2012/02/01 10:43pm
Where can I download the extension from?

Thanks very much!

#6526 report it
MichaelH at 2012/01/16 11:07am
Works great!

Very good extension works right out of the box.

I did made some changes ;-)

"<?=" has been replaced with "<?php echo" in the views. There is always that one host that doesn't support short tags. (mine)

In the init() function it looks like you are making calls to abstract functions "self::" instead of "$this->" have no idea why this is?

I made the widget extend from CWidget instead of CInputWidget

Added a public property $htmlOptions and changed last line social->renderSocial()

from

echo $this->render('social', array('rendered'=>$rendered));

to

$this->htmlOptions['id']=$this->getId();
echo CHtml::tag('div', $this->htmlOptions, $rendered);
#6428 report it
Sampa at 2012/01/09 08:13pm
Awesome

absolutely awesome job done here.

#5686 report it
MetaYii at 2011/11/01 04:06pm
Good work.

Very easy to use. Just a minor problem: multiple G+ buttons on the same page are not displayed.

#5331 report it
Gustavo Lima at 2011/10/05 08:17am
:D

Very Good!

Leave a comment

Please to leave your comment.

Create extension