If you have a CCK type and use Contemplate to format it, you can write PHP code to customize the display. That's good. But is there a way to know whether or not this node is being shown as part of a View?

If so, how? And how to know which View?

Thank you!

Comments

ardee-1’s picture

I figured out a way to do this for Views that create a Page: tell the View to assign the created Page a URL like "view/abc" or "view/xyz". Within your Contemplate code, if arg(0) == "view" then you can check the value of arg(1) to determine which View created the Page (== "abc" or == "xyz", for example).

I still don't know how to do this for Views that create a Block (which has no URL to latch onto).

Ideas, anybody?

Gabriel R.’s picture

I'm having the same problem. I would like to test in node.tpl.php is the current call comes from a specific view or not, and do things accordingly.

-- NO, don't read this signature!

Gabriel R.’s picture

This is supposed to work...

http://drupal.org/node/304062

But it doesn't for me.

-- NO, don't read this signature!