How to backtrace a variable in php template Currently I am in a .tpl.php file, and have the following piece of code:

  &lt;?php if ($rows): ?&gt;
  &lt;div class="view-content"&gt;
    &lt;?php print $rows; ?&gt;
  &lt;/div&gt;
  &lt;?php elseif ($empty): ?&gt;
  &lt;div class="view-empty"&gt;
    &lt;?php print $empty; ?&gt;
  &lt;/div&gt;
  &lt;?php endif; ?&gt;


It seems extremely difficult to figure where the $rows variable comes from. Any good idea?
You can do it using devel module and ddebug_backtrace() api function exposed by devel..

Below is the function call stack for page.tpl.php executed using below command..

&lt;?php dpm(ddebug_backtrace());?&gt;




I believe above tpl is related to views module... $rows are generated dynamically by views module based on your views settings...