title: how can i get the parent elements id, that surrounds the php code, wtih php
body: <p>I'd like to check if the executed <code>php</code> code is within the div called <code>"parent2"</code>. </p>
  
  <p>I am working on a joomla html override and i have to put one module on 2 different positions. </p>
  
  <p>If the module is inside of <code>parent2</code> some different code should be executed inside of the html override.</p>
  
  <p>The only Problem I have right now is, that I don't know how to check the parent id's that surround the php code.</p>
  
  <pre><code>&lt;div id="parent2"&gt;
       &lt;div id="parent1"&gt;
             &lt;?php
                   echo ; /*id of the second parent. Here would be the php code of the html override*/
             ?&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>I want the echo function to print "parent2"</strong>. </p>
  
  <p>Parent1 and Parent2 are part of the joomla template and inside of parent1 there is a <code>jdoc:include</code> module position.</p>
  
  <p>I really tried to find a solution via google but all i could find was something with <code>DOMDocument</code> and html parsers, which i believe wont help me. </p>