- Learned more about Symfony
- Learned how to integrate most recent Twitter tweets in a website
- Learned how to change the number of recent entries in the Recent Content block in Drupal 6
- Participated in a couple of brainstorming/walk-through sessions on an up-coming contest web/Facebook app
- Investigated/experimented with Facebook's Social Plug-ins, Dialogs, and FQL (Facebook Query Language)
- Investigated/experimented with Omega (960gs & HTML5) Theme (in conjunction with Context, Delta, and Omega Tools modules) for Drupal
- Investigated/experimented with mobile device friendly WordPress and Drupal themes
Symfony: Why learning so much about Symfony? One of the projects is to refresh an existing website. This website was built with Symfony. It also has an integration with WordPress.
After having gone through the beginner's tutorials looking at existing source code isn't too scary. Okay, at least until you see something those beginner's tutorial never talked about. This is exactly what happened. I was staring at some strangely named PHP files (all prefixed with an underscore) are being executed but I couldn't see the inclusions of these PHP files. I can tell the code inside these strangely named PHP files being executed. After some Googling / digging through Symfony's documentation, my Symfony lightbulb became brighter.
It turns out that an underscore ("_") prefixed PHP file name indicates that it is a Symfony's Partial. A Symfony Partial is a PHP file containing re-usable chunk of template code. They are stored in the module's templates directory and they are referenced in other PHP files by the Symfony function "include_partial." For example:
Module: mymodule
Partial: _mypartial.php
Usage: include_partial('mymodule/mypartial');
Twitter: There are a couple of ways to get your (or someone else's) Twitter feed to your own (or someone else's) website. One of the way (might be an older method) is retrieve the tweets as an RSS feed. Twitter provides a JavaScript to parse the tweets from the feed (in JSON format) into an un-order list (with id "twitter_update_list"). You will have to style the content yourself. Here is an example:
Twitter Account: TweetLukeLau
Number of Tweets to Retrieve: 5
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<ul id="twitter_update_list">
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/TweetLukeLau.json?callback=twitterCallback2&count=5"></script>
</ul>
The second method is use a Twitter Widget. Twitter provide a customization wizard. Basically you fill in some blanks, select / set the options, and generate the code. Styling the content is done through the options you set in the customization wizard. Here is an example:
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 5,
interval: 6000,
width: 250,
height: 300,
theme: {
shell: {
background: '#333333',
color: '#ffffff'
},
tweets: {
background: '#000000',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('twitter').start();
</script>
Facebook: It is amazing how much information one can find out from Facebook about its users, activities, etc. without being a Facebook user or log into Facebook. Facebook has developed its own database query language (called FQL) that can be issued as part of an URL. The default result is in XML format. It can also return the result in JSON format.
FQL Query URL: https://api.facebook.com/method/fql.query?query=QueryString
FQL Query String: select ColumnList from Table where Condition
For Example, to get Like statistics about an URL:
Table: link_stat
ColumnList: url, normalized_url, share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid
Condition: url = "http://lukelauprojects.blogspot.com/search/label/2011 Interactive Design Internship"
The FQL Query URL would look like this:
https://api.facebook.com/method/fql.query?query=select url, normalized_url, like_count, comment_count, share_count, total_count from link_stat where url = 'http://www.lukelau.com/'
Drupal: Drupal's Omega (960gs & HTML5) theme in conjunction with Context, Delta, and Omega Tools modules is really cool! You can literally have a different layout for different context (Node Type, Path, Taxonomy Term, User Role, User Page, Views, etc.) without programming. First you configure the Omega (960gs & HTML5) theme. Then you use the Delta module to define / configure additional layouts. Now you are ready to tie these additional layouts defined in Delta via the Context module (all based on conditions).
