Navigation
Back to Homepage
What is SiteBar?
Screenshot Tour
Getting Started
Services and Prices
Get Involved!
Contact Us
 
Download Server Software (GPL)
Requirements
Translations
Development Team
Embedding SiteBar
Bugzilla - [Search] [New]
Forums - [Help] [Features] ...
TeamForge.net
Project Information
The menu above
Powered by PHP Layers Menu
SiteBar in IFRAME
 

Embedding SiteBar

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 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:

Loading ...
http://beta.sitebar.org/
http://beta.sitebar.org/
http://beta.sitebar.org/skins/SiteBarXP/
1
name
<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>
Ondrej Brablc's Bookmarks
Kucera IPC GmbH
Life in Germany
Society
Ne softwarovým patentům!
Mats Bergsten's Bookmarks
Webbkatalogen
Datorer
Internet

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');
?>
      

Blogroll Writer

Adding a list of newest links to your page could be as easy as putting there following JavaScript code:
<script
    type="text/javascript"
    src="http://localhost/sitebar/index.php?w=blogroll&sort=added&max=10">
</script>

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.

The site and services are proudly provided by SiteBar authors. SiteBar is free open source software. Copyright © 2003-2016 Ondřej Brablc, © 2004 SiteBar Team, © 2003 David Szego.