Sometimes you may need to be able to display a page in MOSS with the left nav and top nav that is part of the default master page and layout. One of the reasons could be that you're trying to display the page within the frame of another application and only wish to show the page content.
In such a case here's a nifty way to hide the sharepoint 2007 navigational elements on a page without having to touch the masterpage or page layouts.
I crafted a custom webpart (attached) - dwp webpart without any server side code - that you can add to the webpart gallery of your site collection. The webpart is just a modified content editor webpart exported that puts a small ammount of javascript on the page to hide the navigation panes. It looks for a query string parameter called pure which if set to 1 will not display the navigation.
e.g. if the webpart is added to /default.aspx page on a site - if /default.aspx is called, the page will display as normal. If /default.aspx?pure=1 is called, the page will be displayed without any top nav or left nav.
ofcourse you can modify the script within the webpart any which way to only hide the left nav or only hide the top nav or hide custom elements as well with additional URL parameters.
this is the script that gets added to your page:
<script>
JSRequest.EnsureSetup();
displaytype = JSRequest.QueryString["pure"];
if(displaytype==1)
{
document.write("<style>.ms-leftareacell,.ms-globallinks,.ms-siteaction,.ms-areaseparatorleft,.ms-rightareacell,.ms-areaseparatorright,.ms-areaseparatorcorner,.ms-titlearealeft,.ms-titlearearight,.ms-searchform,.ms-banner,.ms-buttonheightwidth,.ms-buttonheightwidth2, .ms-globalTitleArea, .ms-globalbreadcrumb, .ms-bannerContainer, .ms-pagetitleareaframe, .ms-consolestatuscell, .ms-pagemargin, .ms-bodyareapagemargin, .ms-pagebottommarginleft,.ms-pagebottommarginright, .ms-pagebottommargin, .ms-titleareaframe {display:none !IMPORTANT; } .ms-bodyareaframe, .ms-bodyareacell, .ms-propertysheet { border:0px !IMPORTANT; }</style>");
}
</script>
Quite simple really but effective. Enjoy.
NavigationHider.dwp (2.16 kb)