Wednesday, January 28, 2009

About symfony 1.3

Two years ago, it was about to release symfony 1.0. Since then, released symfony 1.1 in June 2008 and symfony 1.2 just two months ago. The 1.1 version of the framework was a major upgrade with a lot of changes to the internals. The 1.2 version finished the transition from the old form system to the new one with the new admin generator, and of course also came with its batch of other goodies.

Some time ago, Tim Ariyeh wrote a tweet about what he thinks about the latest releases:

"I think it's time we all admitted that symfony 1.2 should have been 2.0, and 1.1 should never have happened."

He is quite right, sometimes, we make mistakes. But this is now history and I'm quite happy with the state of symfony 1.2. The internals of symfony are rock solid, well decoupled, and easy to extend. It Now even support Doctrine natively. The documentation has also been updated accordingly with a new book, and a lot of new cookbook tutorials.
What?

First, don't expect big revolutions for symfony 1.3. The 1.3 release will be an evolution of the actual code base, made of polish, small enhancements, and optimisations. That means that one of the most important goal for symfony 1.3 is compatibility with 1.2. The tries are being done to ease the process of upgrading as much as possible. According to the symfony website statistics, symfony 1.2 is already, and by far, the most downloaded symfony version. And the Jobeet tutorial, which is based on symfony 1.2, has generated more than one million page views in less than two months.

You can now add your own ideas and vote for the ones you want to see implemented on a user voice page.

OUTDATED: Display user submitted images in their profile page

description

This snippet will display the thumbnail images of the most N most recently submitted images by the user. You can also optionally limit the images selected based on taxonomy term id's (see snippet for details)

instructions

  1. In a text editor paste the following snippet into your user_profile.tpl.php file
    (For instructions on how to get started with your own custom user profile layout click through to the Customising the user profile layout handbook page.)
  2. Upload your edited user_profile.tpl.php to your active theme folder
// Display N most recent thumbnails of images submitted by the user
// Each thumbnail is linked back to it's image node
// Can optional limit the photos shown by specififying one or taxonomy term id's

// The number of thumbnail images to show
$nlimit = 3;
$taxo_id = array();
// Add one line for each taxonomy term id you want to limit the thumbnails to
// As an example, the following two lines would select images associated with taxonomy terms 36 OR 37
// $taxo_id[] = 36;
// $taxo_id[] = 37;
// Note, if not taxonomy term ids are specified, the selection is from all the user submitted images

$userid=$user->uid;

if (
count($taxo_id) > 0 ) {
// Limit images based on taxonomy term id's
$taxo_str = implode(',', $taxo_id);
$sql = "SELECT n.created, n.title, n.nid, n.changed FROM node n INNER JOIN term_node ON n.nid = term_node.nid AND term_node.tid IN ($taxo_str) WHERE n.type = 'image' AND n.uid = $userid AND n.status = 1 ORDER BY n.changed DESC";
}
else {
$sql = "SELECT n.created, n.title, n.nid, n.changed FROM node n WHERE n.type = 'image' AND n.uid = $userid AND n.status = 1 ORDER BY n.changed DESC";
}

$result = db_query_range($sql, 0, $nlimit);
$output = '';
while (
$info = db_fetch_object($result) ) {
$node = node_load(array('nid' => $info->nid));
$img_tag = image_display($node, 'thumbnail');
$link = 'node/' . $node->nid;
$output .= l($img_tag, $link, array(), NULL, NULL, FALSE, TRUE);
}
print
$output;
?>