Drupal:检测某个.tpl文件是否被使用的方法?

I am working on a site that uses a module that uses 2 .tpl files, eg: list.tpl and product.tpl. A 3rd .tpl file, product-image.tpl, is used within each of these and is called with a render function, eg:

On list.tpl:

<div id="list-images">
  <?php print render($element['productImage']);?>
</div>

and on product.tpl:

<div id="product-images">
  <?php print render($element['productImage']);?>
</div>

I want to modify the output of product-image.tpl when it displays on product.tpl. For example, something along the lines of:

"If I am being used on product.tpl do this {..."

Would anyone know of a way to have product-image.tpl know what .tpl it is being used on?

I kinda got this working, but it's not the most elegant way.

On product.tpl I added a new elemet to the $element array:

<div id="product-images">
  <?php $element['productImage']['singleProd'] = true; ?>
  <?php print render($element['productImage']);
</div>

This allowed me to detect a difference later on when I used that array.

So, back on product-image.tpl:

if (!empty($element['singleProd'])){
   //do the things needed for product.tpl
}
else {
  //do the things needed for list.tpl
}

If anyone knows of a better way I would still be glad to hear it.