Translate simple code snippet - Get taxonomy term id im following this great podcast which is drupal 5 (i guess).

I want to add a View into my page--taxonomy.tpl.php and get the id of the taxonomy term im currently looking at. Could maybe anybody translate this code snippet for drupal 7?

&lt;?php
$view = views_get_view('taxonomypages');
$display = $view-&gt;execute_display('block_1', 2);
print $display['content'];
?&gt;


I figured out that this shows me the view:

$view = views_get_view('taxonomypages');
print $view-&gt;preview('block_1',$tids);


but $tids is undefined.
i need to have the current taxonomy term id that im looking at e.g when im at taxonomy/term/12 the id is 12 but $tids is undefined.
I never used "page--taxonomy.tpl.php", but based upon what you want to do, I guess your looking for taxonomy-term.tpl.php.

In Drupal 7, you have a $term variable, from which you can get the tid. Below is some D7 code I've used for a similar purpose, that I adapted a bit to yours. Note that the argument to Views must be in an array.

$view = views_get_view('taxonomypages');
$view-&gt;execute_display('panel_pane_1', array($term-&gt;tid));
$output = $view-&gt;render();


But I do not recommend you proceed down this path. Instead use Panels, and pass the argument to a View that way. Yes, it will require a bit more configuration, but it will also be much more sustainable, easier to maintain, and keep less logic in the template files.

Relevant panels tutorials here.