SiteBar 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 need to store some hidden data on the page:
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>
If you still do not see anything, it may be because you have not published any bookmarks, so either publish them, or execute following line before the run() command (username and password should be replaced with correct credentials):
<?php $writer->um->login('username','password'); ?>
PHP Layers Menu
SiteBar can provide input for PHP Layers Menu. The url may look like http://my.sitebar.org/index.php?w=phplm&root=1. The use inside of PHP LM is as easy as using this URL instead of the filename with the menu structure, in our case we execute this
<?php // This will be done in the <head> include ("phplm/lib/PHPLIB.php"); include ("phplm/lib/layersmenu-common.inc.php"); include ("phplm/lib/layersmenu.inc.php"); $mid->dirroot = "./phplm/"; $mid->libjsdir = "./phplm/libjs/"; $mid->imgdir = "./phplm/images/"; $mid->imgwww = "phplm/images/"; $mid->tpldir = "./phplm/templates/"; $mid = new LayersMenu(); $mid->setMenuStructureFile("http://my.sitebar.org/index.php?w=phplm&root=1"); $mid->parseStructureForMenu("vermenu1"); $mid->newVerticalMenu("vermenu1"); $mid->printHeader(); // And this will go to the place where menu should be shown print $mid->printMenu("vermenu1"); ?>
And where is the output? Just check the gray menu block on the left side. It is automatically populated from the database.