Is there a function for drupal that can identity if a certain page and its children are being viewed? So I have nav that looks like this:

&lt;li&gt;
  &lt;a href="/some-parent-url"&gt;Parent Url&lt;/&gt;
  &lt;ul&gt;
    &lt;li&gt;
       &lt;a href="/some-parent-url/child-url-2"&gt;Child Url&lt;/a&gt; 
    &lt;/li&gt;
    &lt;li&gt;
       &lt;a href="/some-parent-url/child-url-2"&gt;Child Url&lt;/a&gt; 
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;


I would like to add an "active" class to the Parent URl if a user is on the page with url "some-parent-url" or any of it's parent url?

Ideally something like 

&lt;a href="/some-parent-url" &lt;?php if (some_drupal_code_for_this){ echo 'class="active"'; } ?&gt;&gt;Parent Url&lt;/&gt;
You could use Menu Trail By Path module. 


  Menu Trail By Path sets the active-trail on menu items according to
  the current url.


For example if you are at yoursite.com/blog/category1/article1
Menu Items with these paths will get the active-trail class on them and expand accordingly.