|
Embedding SiteBarSiteBar can be embedded to any page using IFRAME (see the left bottom part of this screen). Please note, that MS IE users may experience cookie related problem when you embed SiteBar installed on some domain (lets say my.sitebar.org) to your page running at example.com. They will have to allow the 2nd level domain sitebar.org to place cookies in the browser settings. Embedded Writer (requires SiteBar 3.3.12)The SiteBar tree reendered bellow is not included in an IFRAME. It is directly embedded into this page using PHP code. Lets assume that SiteBar is installed in the sitebar subdirectory - our test file is now called emb.php, and available at http://localhost/emb.php. SiteBar is available at http://localhost/sitebar. Lets make it interesting by using other than the default skin: <?php $oldDir = getcwd(); // SiteBar PHP files must be available on this server, // we change temporarily to the installation directory. chdir("sitebar"); // Inject direct and indirect classes require_once('./inc/writers/sitebar_emb.inc.php'); // Create the writer object. $writer = new SB_Writer_sitebar_emb(); // Do we want another skin? SB_Skin::set("SiteBarXP"); // We change both the absolute and the relative URL, // we may run on a different subdomain or use an alias. SB_Page::absBaseUrl('http://localhost/sitebar/'); SB_Page::relBaseUrl('http://localhost/sitebar/'); // Restore pwd, if you want to load some other files chdir($oldDir); ?> We will need to link the style sheet and javascript library (pay attention to every single /):
<link rel="StyleSheet"
href="<?php echo SB_Skin::src('sitebar.css')?>"
type="text/css" media="all">
<script type="text/javascript"
src="<?php echo SB_Page::absBaseUrl() ?>inc/sitebar.js">
</script>
We need to store some hidden data on the page: <div style="display:none"> <?php $writer->drawJavaScriptData(); ?> </div> And here we execute following command to render the tree, we include it in the div with proper class names to apply the SiteBar styles only inside of the div and not on the complete page. <div class="siteBar siteBarBaseFont siteBarPageBackground"> <?php $writer->run(); ?> </div> |