Theming Twitter views

Last updated on
17 August 2018

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Using Twitter module with Views2 on a membership site and needed a way to link back to members on Twitter, so wrote this views-view-fields--tweet.tpl.php override that links each tweet back to site member's Twitter account:

<div class="twitter_users_picture">
	<a href="http://www.domain.com/<?php print $row->users_name; ?>"><img src="http://www.domain.com/<?php print $row->users_picture; ?>" /></a>
</div>

<div class="twitter_users_name">
	<a href="http://www.domain.com/<?php print $row->users_name; ?>"><?php print $row->users_name; ?></a> says:
</div>

<div class="twitter_text">
	<?php print $row->twitter_text; ?>
</div>

<div class="twitter_created_time">
	Tweeted <?php print format_date($row->twitter_created_time); ?>
</div>

<div class="twitter_screen_name">
	<a href="http://www.twitter.com/<?php print $row->twitter_screen_name; ?>">Follow <?php print $row->twitter_screen_name; ?> on Twitter</a>
</div>

I'm not a programmer or themer, so there are probably better ways to do this but it solved some output formatting issues for me. I'm not good enough to get the @names in the tweets to link, although it would be nice!

Help improve this page

Page status: No known problems

You can: