You are here
Breadcrumb Test
Show/Hide PHP source
// TODO: Locale additions
$locale['global_breadcrumb_001'] = "You are here";
$locale['global_breadcrumb_002'] = "Home";
// TODO: Settings, and relative admin interface
$settings['breadcrumb_separator'] = " › "; // → || >
$settings['breadcrumb_home'] = true;
$settings['breadcrumb_trim'] = 16;
$settings['breadcrumb_microdata'] = true;
$settings['breadcrumb_custom'] = true; // if home enabled
$settings['breadcrumb_home_name'] = ""; // empty for site name
$settings['breadcrumb_home_url'] = "?hack=<attempt>&try='\"";
$settings['breadcrumb_home_rel'] = "'\"";
$settings['breadcrumb_home_class'] = "first second '\""; // comma separated
$settings['breadcrumb_home_totitle'] = 1; // bool
$settings['breadcrumb_home_titleonly'] = 0; // bool
$settings['breadcrumb_listview'] = false;
$settings['breadcrumb_helper'] = true;
$settings['breadcrumb_rseparator'] = " < "; //" < ";
$settings['breadcrumb_htmltitle'] = true;
add_to_head("<style type='text/css'>
/*<![CDATA[*/
.source { overflow-x: scroll; width: 600px; }
.screen-reader { display: none; } /** "You are here" text **/
.breadcrumb { border: 0.1em solid #e1e1e1; padding: 0.3em 0.4em; margin-bottom: 0.6em;
color: #555555; background-color: #FEFDFB; }
ul.breadcrumb { display: block; height: 2.8em; margin-top: 0; }
.breadcrumb li { float: left; list-style: none; margin-right: 0.5em; }
.breadcrumb li .brcr-url { float: left; display: block; border: 0.1em solid #e1e1e1;
background-color: #fff; margin: 0.3em 0.4em; padding: 0.3em 0.5em; }
.breadcrumb li .brcr-title { border: 0.1em solid #e1e1e1; background-color: #f6f6f6;
margin: 0.3em 0.4em; padding: 0.3em 0.5em; }
.breadcrumb li a { text-decoration: none; }
.breadcrumb li a:hover { background-color: #e3e3e3; }
.breadcrumb li ul { float: left; margin: 0; padding: 0; list-style: none; }
.breadcrumb li ul li { float: left; }
.current-breadcrumb-item { font-weight: bolder; }
.hungry-item { font-style: italic; } /** custom usage example **/
.awake-item { text-decoration: blink; } /** custom usage example **/
/*]]>*/
</style>");
echo "<!-- breadcrumb-placeholder -->"; // <-- should go into theme.php
opentable("Breadcrumb Test");
echo "<!-- breadcrumb-placeholder -->"; // <-- should go into theme.php
$breadcrumb = init_breadcrumb(); // <-- should go into maincore.php
add_breadcrumb("TestBreadcrumb", "testBreadcrumb.php"); // <-- call in need
add_breadcrumb("Very log text to be passed as \$name argument", FUSION_SELF.'?attempt=<hack>'); // <-- call in need
add_breadcrumb("Not in title", '', '', '', false); // <-- if you want to place something into the breadcrumbs but not into the html title
show_breadcrumb(); // <-- should go into footer.php
add_to_title_brcr("TestBreadcrumb Page"); // <-- if you want to place something into the html title but not into the breadcrumbs
title_with_breadcrumb(); // <-- should go into footer.php
closetable();
You are here
Show/Hide HTML source
<h2 class='screen-reader hide'>You are here</h2>
<div itemscope itemtype='http://data-vocabulary.org/Breadcrumb' class='breadcrumb'>
<a href='?hack=%3Cattempt%3E&try=%27%22' class='first second brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>PHP-Fusion Po...</span></a> ›
<span itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'><a href='testBreadcrumb.php' class='current-breadcrumb-item brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>TestBreadcrumb</span></a> ›
<span itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'><a href='testBreadcrumb.php?attempt=%3Chack%3E' class='brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>Very log text...</span></a> ›
<span itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'><span class='brcr-url'><span itemprop='title' class='brcr-title'>Not in title</span></span> </span>
</span>
</span>
</div>
Show/Hide dump
Breadcrumb Object
(
[_separator:Breadcrumb:private] => ›
[_home:Breadcrumb:private] => 1
[_trim:Breadcrumb:private] => 16
[_i:Breadcrumb:private] => 5
[_breadcrumb:Breadcrumb:private] => Array
(
[0] => Array
(
[name] => PHP-Fusion Powered Website
[url] => ?hack=%3Cattempt%3E&try=%27%22
[rel] =>
[class] => Array
(
[0] => first
[1] => second
)
[totitle] => 1
[titleonly] =>
)
[1] => Array
(
[name] => TestBreadcrumb
[url] => testBreadcrumb.php
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Very log text to be passed as $name argument
[url] => testBreadcrumb.php?attempt=%3Chack%3E
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => Not in title
[url] =>
[rel] =>
[class] => Array
(
)
[totitle] =>
[titleonly] =>
)
[4] => Array
(
[name] => TestBreadcrumb Page
[url] =>
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] => 1
)
)
[_trail:Breadcrumb:private] => Array
(
[0] => Array
(
[name] => PHP-Fusion Powered Website
[url] => ?hack=%3Cattempt%3E&try=%27%22
[rel] =>
[class] => Array
(
[0] => first
[1] => second
)
[totitle] => 1
[titleonly] =>
)
[1] => Array
(
[name] => TestBreadcrumb
[url] => testBreadcrumb.php
[rel] =>
[class] => Array
(
[1] => current-breadcrumb-item
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Very log text to be passed as $name argument
[url] => testBreadcrumb.php?attempt=%3Chack%3E
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => Not in title
[url] =>
[rel] =>
[class] => Array
(
)
[totitle] =>
[titleonly] =>
)
[4] => Array
(
[name] => TestBreadcrumb Page
[url] =>
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] => 1
)
)
[_html:Breadcrumb:private] => Array
(
[0] => PHP-Fusion Po...
[1] => TestBreadcrumb
[2] => Very log text...
[3] => Not in title
)
[_microdata:Breadcrumb:private] => 1
)
Custom usage of Breadcrumb -- without home, with microdata
Show/Hide PHP source
$test = new Breadcrumb(
" / ",
false,
20,
true
);
$test->AddTrail("Very first item", "#nogo");
$test->ShowTrail(); // lele_debug( $test );
$test->AddTrail("Second item", "#nogo");
$test->ShowTrail(); // lele_debug( $test );
$test->AddTrail("This is not a link");
$test->ShowTrail();
$test->ShowTrail(true); // // html ul
You are here
You are here
You are here
Show/Hide HTML source
<h2 class='screen-reader hide'>You are here</h2>
<div itemscope itemtype='http://data-vocabulary.org/Breadcrumb' class='breadcrumb'>
<span itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'><a href='#nogo' class='brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>Very first item</span></a> /
<span itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'><a href='#nogo' class='brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>Second item</span></a> /
<span itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'><span class='brcr-url'><span itemprop='title' class='brcr-title'>This is not a link</span></span> </span>
</span>
</span>
</div>
You are here
Show/Hide HTML source
<h2 class='screen-reader hide'>You are here</h2>
<ul itemscope itemtype='http://data-vocabulary.org/Breadcrumb' class='breadcrumb'>
<li><a href='#nogo' class='brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>Very first item</span></a>
<ul itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'>
<li><a href='#nogo' class='brcr-url' itemprop='url'><span itemprop='title' class='brcr-title'>Second item</span></a>
<ul itemprop='child' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'>
<li><span class='brcr-url'><span itemprop='title' class='brcr-title'>This is not a link</span></span></li>
</ul>
</li>
</ul>
</li>
</ul>
Show/Hide dump
Breadcrumb Object
(
[_separator:Breadcrumb:private] => /
[_home:Breadcrumb:private] => 1
[_trim:Breadcrumb:private] => 20
[_i:Breadcrumb:private] => 4
[_breadcrumb:Breadcrumb:private] => Array
(
[1] => Array
(
[name] => Very first item
[url] => #nogo
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Second item
[url] => #nogo
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => This is not a link
[url] =>
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
)
[_trail:Breadcrumb:private] => Array
(
[1] => Array
(
[name] => Very first item
[url] => #nogo
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Second item
[url] => #nogo
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => This is not a link
[url] =>
[rel] =>
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
)
[_html:Breadcrumb:private] => Array
(
[1] => Very first item
[2] => Second item
[3] => This is not a link
)
[_microdata:Breadcrumb:private] => 1
)
Custom usage of Breadcrumb -- advanced example, without microdata
Show/Hide PHP source
$debug = new Breadcrumb(
" ⇒ ",
array(
'name' => "House",
'url' => "http://www.php-fusion.co.uk/",
'rel' => "da-houz",
'class' => array('poking', 'around')
)
);
$debug->AddTrail("Fridge", "http://www.php-fusion.co.uk/fridge", 'hungry');
$debug->ShowTrail();
$debug->AddTrail("Sofa", "http://www.php-fusion.co.uk/sofa", '', array('warm','confortable'));
$debug->ShowTrail();
$debug->AddTrail("Y U NOT go to sleep?", '', 'awake');
$debug->ShowTrail();
$debug->ShowTrail(true); // html ul
$debug->AddTrail("Javascript test", "#here", 'js-test', 'js-click-me just-another-class');
$debug->ShowTrail();
add_to_head("<script type='text/javascript'>
/*<![CDATA[*/
jQuery(document).ready(function(){
jQuery('.js-click-me').click(function(e){
var rel = jQuery(this).attr('rel');
if ( confirm('really you clicked me?') ) {
alert(rel+' clicked. thanks.');
} else {
alert('Y U NOT clicked '+rel);
}
e.preventDefault();
});
});
/*]]>*/
</script>");
You are here
You are here
You are here
You are here
You are here
Show/Hide HTML source
<h2 class='screen-reader hide'>You are here</h2>
<ul class='breadcrumb'><li><a href='http://www.php-fusion.co.uk/' class='poking around da-houz-item brcr-url' rel='da-houz'><span class='brcr-title'>House</span></a></li><li><a href='http://www.php-fusion.co.uk/fridge' class='hungry-item brcr-url' rel='hungry'><span class='brcr-title'>Fridge</span></a></li><li><a href='http://www.php-fusion.co.uk/sofa' class='warm confortable brcr-url'><span class='brcr-title'>Sofa</span></a></li><li><span class='awake-item brcr-url'><span class='brcr-title'>Y U NOT go to sleep?</span></span></li><li><a href='#here' class='js-click-me js-test-item brcr-url' rel='js-test'><span class='brcr-title'>Javascript test</span></a></li></ul>
Show/Hide dump
Breadcrumb Object
(
[_separator:Breadcrumb:private] => ⇒
[_home:Breadcrumb:private] => 1
[_trim:Breadcrumb:private] =>
[_i:Breadcrumb:private] => 5
[_breadcrumb:Breadcrumb:private] => Array
(
[0] => Array
(
[name] => House
[url] => http://www.php-fusion.co.uk/
[rel] => da-houz
[class] => Array
(
[0] => poking
[1] => around
)
[totitle] =>
[titleonly] =>
)
[1] => Array
(
[name] => Fridge
[url] => http://www.php-fusion.co.uk/fridge
[rel] => hungry
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Sofa
[url] => http://www.php-fusion.co.uk/sofa
[rel] =>
[class] => Array
(
[0] => warm
[1] => confortable
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => Y U NOT go to sleep?
[url] =>
[rel] => awake
[class] => Array
(
)
[totitle] => 1
[titleonly] =>
)
[4] => Array
(
[name] => Javascript test
[url] => #here
[rel] => js-test
[class] => Array
(
[0] => js-click-me
)
[totitle] => 1
[titleonly] =>
)
)
[_trail:Breadcrumb:private] => Array
(
[0] => Array
(
[name] => House
[url] => http://www.php-fusion.co.uk/
[rel] => da-houz
[class] => Array
(
[0] => poking
[1] => around
[2] => da-houz-item
)
[totitle] =>
[titleonly] =>
)
[1] => Array
(
[name] => Fridge
[url] => http://www.php-fusion.co.uk/fridge
[rel] => hungry
[class] => Array
(
[0] => hungry-item
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Sofa
[url] => http://www.php-fusion.co.uk/sofa
[rel] =>
[class] => Array
(
[0] => warm
[1] => confortable
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => Y U NOT go to sleep?
[url] =>
[rel] => awake
[class] => Array
(
[0] => awake-item
)
[totitle] => 1
[titleonly] =>
)
[4] => Array
(
[name] => Javascript test
[url] => #here
[rel] => js-test
[class] => Array
(
[0] => js-click-me
[1] => js-test-item
)
[totitle] => 1
[titleonly] =>
)
)
[_html:Breadcrumb:private] => Array
(
[0] => House
[1] => Fridge
[2] => Sofa
[3] => Y U NOT go to sleep?
[4] => Javascript test
)
[_microdata:Breadcrumb:private] =>
)
"API": $debug->GetRawTree();
Show/Hide dump
Array
(
[0] => Array
(
[name] => House
[url] => http://www.php-fusion.co.uk/
[rel] => da-houz
[class] => Array
(
[0] => poking
[1] => around
[2] => da-houz-item
)
[totitle] =>
[titleonly] =>
)
[1] => Array
(
[name] => Fridge
[url] => http://www.php-fusion.co.uk/fridge
[rel] => hungry
[class] => Array
(
[0] => hungry-item
)
[totitle] => 1
[titleonly] =>
)
[2] => Array
(
[name] => Sofa
[url] => http://www.php-fusion.co.uk/sofa
[rel] =>
[class] => Array
(
[0] => warm
[1] => confortable
)
[totitle] => 1
[titleonly] =>
)
[3] => Array
(
[name] => Y U NOT go to sleep?
[url] =>
[rel] => awake
[class] => Array
(
[0] => awake-item
)
[totitle] => 1
[titleonly] =>
)
[4] => Array
(
[name] => Javascript test
[url] => #here
[rel] => js-test
[class] => Array
(
[0] => js-click-me
[1] => js-test-item
)
[totitle] => 1
[titleonly] =>
)
)
"API": $debug->CountCrumbs();
int(5)
