How to use value passed to views_embed_view as a filter? I want to embed a View in a node template. I understand that I can use views_embed view to do that, and pass values to it.    

$my_arg = $node-&gt;nid; //the nid of the node that I want to use as filter
print views_embed_view('my_test_view', 'block_2', $my_arg);


How can I use that value as a filter ? I want that view to list nodes that have a field with the same value as the passed to the function
The value you pass as last argument to views_embed_view is not passed to the Views' filters, but to the view's contextual filters  (also known as arguments). Contextual Filters are like filters, expect they take external input (from the URL when viewed as a page or from the arguments passed to functions such as views_embed_view). You can learn more about contextual filters here: http://drupal.org/node/1578558