eZ Community » Blogs » Thiago Campos Viana » Tip: Twitter button template

By

Tip: Twitter button template

Saturday 17 September 2011 8:59:51 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

In this post I will show how to include the twitter button.

Please check also the tip about the google plus one button.

So, create a file called 'twitterbutton.tpl' inside your design template folder. Put this content in the file:

{ezscript_require( array('ezjsc::jquery','http://platform.twitter.com/widgets.js') )}
{def $c=cond( is_set($count), $count, 'horizontal' )}
 
<a href="https://twitter.com/share" class="twitter-share-button" data-count="{$c}"
{if is_set($via)} data-via="{$via}"{/if}
{if is_set($text)} data-text="{$text}"{/if}
{if is_set($url)} data-url="{$url}"{/if}
{if is_set($lang)} data-lang="{$lang}"{/if}>Tweet</a>
{undef}

Now you can use this template this way:

{include uri="design:twitterbutton.tpl" via="ezcommunity" text="hello world!" url="http://share.ez.no" lang="en" count="vertical"}

Please note that via, text, url, lang and count are optional values, you can check the twitter button doc for more info.

Proudly Developed with from