How do I insert PHP before and after HTML code from an external PHP sheet? (Wrap a div with PHP)
<p>Here is my issue, I have an assortment of PHP files that creates a certain theme for my website.  I have created what you could call a child theme that uses the PHP framework from that parent theme but with an alternate CSS and a kind of functions.php.  Within the parent theme's PHP there is HTML to create assorted <code>&lt;div&gt;</code>s.  What I need is to use the child's functions.php to wrap a block of <code>&lt;div&gt;</code>s from the parent's PHP/HTML with a <code>&lt;div&gt;</code> that has a custom id and class.  In other words, I want to wrap HTML in a <code>&lt;div&gt;</code> using an external PHP sheet - before the <code>&lt;div&gt;</code> opens and after it closes.  </p>

<p>Is there a PHP function that can do this?</p>

<p>I cannot edit the parent theme PHP, and I cannot just copy and paste the code from the parent to the child due to parent theme having upgrading capabilities.
For reference, here is the block of PHP from the parent file.  I want to wrap the <code>&lt;div id="footer"&gt;</code> with a <code>&lt;div&gt;</code> with an id of "footer-wrapper".  </p>

<pre><code>&lt;!-- footer --&gt;
        &lt;div id="footer"&lt;?php $this-&gt;html( 'userlangattributes' ) ?&gt;&gt;
            &lt;?php foreach( $this-&gt;getFooterLinks() as $category =&gt; $links ): ?&gt;
                &lt;ul id="footer-&lt;?php echo $category ?&gt;"&gt;
                    &lt;?php foreach( $links as $link ): ?&gt;
                        &lt;li id="footer-&lt;?php echo $category ?&gt;-&lt;?php echo $link ?&gt;"&gt;&lt;?php $this-&gt;html( $link ) ?&gt;&lt;/li&gt;
                    &lt;?php endforeach; ?&gt;
                &lt;/ul&gt;
            &lt;?php endforeach; ?&gt;
            &lt;?php $footericons = $this-&gt;getFooterIcons("icononly");
            if ( count( $footericons ) &gt; 0 ): ?&gt;
                &lt;ul id="footer-icons" class="noprint"&gt;
&lt;?php           foreach ( $footericons as $blockName =&gt; $footerIcons ): ?&gt;
                    &lt;li id="footer-&lt;?php echo htmlspecialchars( $blockName ); ?&gt;ico"&gt;
&lt;?php               foreach ( $footerIcons as $icon ): ?&gt;
                        &lt;?php echo $this-&gt;skin-&gt;makeFooterIcon( $icon ); ?&gt;

&lt;?php               endforeach; ?&gt;
                    &lt;/li&gt;
&lt;?php           endforeach; ?&gt;
                &lt;/ul&gt;
            &lt;?php endif; ?&gt;
            &lt;div style="clear:both"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;!-- /footer --&gt;
</code></pre>
