Sends a link to any page to Twitter. Hashtags and ShortURL's are optional
Same idea as my "Tweet this topic" and "Tweet this post" snippets.
I realise that some web hosts may block the use of file_get_contents, but there are many workarounds available.
A quick Google search for an alternative to file_get_contents should do the trick
# #-----[ OPEN ]------------------------------------------ # includes/functions.php # #-----[ FIND ]------------------------------------------ #
/** * Generate page header */
# #-----[ AFTER ADD ]------------------------------------------ #
/** * Put in a long URL, get a short one back out * http://www.scripting.com/stories/2007/06/27/tinyurlHasAnApi.html * http://fyneworks.blogspot.com/2008/08/tiny-url-api.html */ function TinyURL($u) { return file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($u)); }
# #-----[ FIND ]------------------------------------------ #
'ROOT_PATH' => $phpbb_root_path,
# #-----[ AFTER ADD ]------------------------------------------ #
'TWEET_PAGE' => urlencode('Check out this page: ') . TinyURL(generate_board_url() . $_SERVER['REQUEST_URI']),
# #-----[ OPEN ]------------------------------------------ # language/en/common.php # #-----[ FIND ]------------------------------------------ #
'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s',
# #-----[ AFTER ADD ]------------------------------------------ #
'TWEET_PAGE' => 'Tweet this page',
# #-----[ OPEN ]------------------------------------------ # styles/prosilver/template/overall_header_body.html # #-----[ FIND ]------------------------------------------ #
Somewhere in the header that you think would suit
# #-----[ AFTER ADD ]------------------------------------------ #
<span class="tweet-link"><a href="http://twitter.com/home?status={TWEET_PAGE}" class="tweet-link" title="{L_TWEET_PAGE}"></a></span>
If you have already installed "Tweet this topic/post", then you can skip the next 2 steps and go straight to purging your cache
#-----[ OPEN ]------------------------------------------ # styles/prosilver/theme/colours.css # #-----[ FIND ]------------------------------------------ #
a.right:hover { color: #5E7BAA; }
# #-----[ AFTER ADD ]------------------------------------------ #
.tweet-link a { float: left; background-image: url("{T_THEME_PATH}/images/twitter-logo.png"); padding-left:18px; height: 18px; background-repeat: no-repeat; position: absolute; }
Place this image in your ./styles/STYLE_NAME/theme/images/ folder