Print a text if a view result is equal to a certain value In a template file, how can I use PHP to print some text if a view has a certain value? 

The view uses the node ID, so I guess this argument needs to be passed to the view (as it would be if the view was embedded onto the page).

Here is my attempt:

&lt;?php
  $view = views_get_view('hide_weight_2');
  if ($view-&gt;execute_display('default', $args) == 'Yes' ):
?&gt;
  &lt;h1&gt;Result of view was yes&lt;/h1&gt;
&lt;?php endif; ?&gt;
If I understand well your question, I guess that you can make this in a rough way from a template View. Inside this template file you can add the respective conditional to show your text.

Here is the part of views-view-unformatted.tpl.php when each result is printed:

&lt;?php foreach ($rows as $id =&gt; $row): ?&gt;
  &lt;div class="&lt;?php print $classes[$id]; ?&gt;"&gt;   
    &lt;?php print $row; ?&gt;
  &lt;/div&gt;
&lt;?php endforeach; ?&gt;


Then, you can parse $row to catch the respective value and print a message. You can use preg_match() to match the value For example, instead of &lt;?php print $row; ?&gt; you could use:

&lt;?php
  if (preg_match("/(here text to match)/i", $row)) {
    print "Aha!:" . $row;
  }
  else {
    print $row;
  }
?&gt;


I guess you can improve this seeking per target fields.