On the way the special PHP variable $this-> behaves when used in a snippet, see the documentation for $this->.
Snippets may call/include other snippets.
From 0.7.0:1) the includeSnippet() function will return “true” if the snippet name is found, but “false” if the snippet name does not exist. If a test is used which evaluates includeSnippet() as “true”, the value of the snippet will be passed automatically.
You could also create a snippet with your php code, then only include it on the relevant page by using a conditional statement. That way you won't need a page-part, and it's only a small addition to your layout:
<?php// only include on contact page or childrenif(url_start_with('/contact'))$this->includeSnippet('the_name_of_the_snippet');?>
Just keep in mind that it will also be included in any children pages, because it's looking for a url that begins with the provided text.