Is there a better way to design this PHP function?
<p>It works but maybe someone of you knows if there is a better way to achieve what I'm trying to do:</p>

<pre><code>&lt;?php if ($md_options-&gt;mobileversion == true) {;?&gt;&lt;!-- Ok Mobile mode is ON --&gt;
    &lt;?php if (detectdevice() != 'true') {;?&gt;&lt;!-- Now if we are NOT on a mobile let's start! --&gt;
        &lt;?php if ((is_single()) &amp;&amp; ($metaBox == true)) {;?&gt;&lt;!-- If is Single and 360Panorama is set let's show panorama --&gt;
            &lt;?php include('360ok.php');?&gt;&lt;!-- Houston we have a panorama! --&gt;
        &lt;?php } elseif ((!is_single()) || ($metaBox != true)){;?&gt;&lt;!-- Each page that hasn't set a panorama will check... --&gt;
            &lt;?php if ($md_options-&gt;slideorvideo == 'true') {;?&gt;&lt;!-- Do you want to show a slideshow? --&gt;
                &lt;?php include('slideshowhome.php');?&gt;&lt;!-- What a nice slideshow! --&gt;
            &lt;?php } elseif ($md_options-&gt;slideorvideo == 'false') {;?&gt;&lt;!-- You prefer a video? let's show it! --&gt;
                &lt;?php include("video/video.php");?&gt;
            &lt;?php };?&gt;&lt;!-- Closes video option --&gt;
            &lt;?php if ($md_options-&gt;slivideoposition != 'center'){;?&gt;&lt;!-- Let's show the post next to the video or slideshow if it is possible --&gt;
                &lt;?php include('postheader.php');?&gt;
            &lt;?php };?&gt;&lt;!-- Closes POSTHEADER --&gt;
        &lt;?php };?&gt;&lt;!-- Close Else if !is_single || $metabox != true --&gt;
    &lt;?php };?&gt;&lt;!-- Closes the function that checks if we are on a mobile or not --&gt;
&lt;?php } elseif ($md_options-&gt;mobileversion != true) {;?&gt;&lt;!-- Closes mobile version ON/OFF --&gt;
    &lt;?php if ((is_single()) &amp;&amp; ($metaBox == true)) {;?&gt;&lt;!-- If is Single and 360Panorama is set let's show panorama --&gt;
        &lt;?php include('360ok.php');?&gt;&lt;!-- Houston we have a panorama! --&gt;
    &lt;?php } elseif ((!is_single()) || ($metaBox != true)){;?&gt;&lt;!-- Each page that hasn't set a panorama will check... --&gt;
        &lt;?php if ($md_options-&gt;slideorvideo == 'true') {;?&gt;&lt;!-- Do you want to show a slideshow? --&gt;
            &lt;?php include('slideshowhome.php');?&gt;&lt;!-- What a nice slideshow! --&gt;
        &lt;?php } elseif ($md_options-&gt;slideorvideo == 'false') {;?&gt;&lt;!-- You prefer a video? let's show it! --&gt;
            &lt;?php include("video/video.php");?&gt;
        &lt;?php };?&gt;&lt;!-- Closes video option --&gt;
        &lt;?php if ($md_options-&gt;slivideoposition != 'center'){;?&gt;&lt;!-- Let's show the post next to the video or slideshow if it is possible --&gt;
            &lt;?php include('postheader.php');?&gt;
        &lt;?php };?&gt;&lt;!-- Closes POSTHEADER --&gt;
    &lt;?php };?&gt;&lt;!-- Close Else if !is_single || $metabox != true --&gt;
&lt;?php };?&gt;&lt;!-- If mobile mode is OFF this closes the IF --&gt;
</code></pre>

<p>The same code (without extraneous <code>&lt;?php ?&gt;</code> tags):</p>

<pre><code>&lt;?php

if ($md_options-&gt;mobileversion == true) {
    if (detectdevice() != 'true') {
        if ((is_single()) &amp;&amp; ($metaBox == true)) {
            include('360ok.php')
        } elseif ((!is_single()) || ($metaBox != true)) {
            if ($md_options-&gt;slideorvideo == 'true') {
                include('slideshowhome.php');
            } elseif ($md_options-&gt;slideorvideo == 'false') {
                include("video/video.php");
            }
            if ($md_options-&gt;slivideoposition != 'center') {
                include('postheader.php');
            }
        }
    }
} elseif ($md_options-&gt;mobileversion != true) {
    if ((is_single()) &amp;&amp; ($metaBox == true)) {
        include('360ok.php');
    } elseif ((!is_single()) || ($metaBox != true)) {
        if ($md_options-&gt;slideorvideo == 'true') {
            include('slideshowhome.php');
        } elseif ($md_options-&gt;slideorvideo == 'false') {
            include("video/video.php");
        }
        if ($md_options-&gt;slivideoposition != 'center') {
            include('postheader.php');
        }
    }
}

?&gt;
</code></pre>

<p>Is there a faster way to reach the same point?</p>
