Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Breadcrumb Script:</p> <pre><code>&lt;?php class Breadcrumb{ var $output; var $crumbs = array(); var $location; function Breadcrumb(){ if ($_SESSION['breadcrumb'] != null){ $this-&gt;crumbs = $_SESSION['breadcrumb'];} } function add($label, $url, $level){ $crumb = array(); $crumb['label'] = $label; $crumb['url'] = $url; if ($crumb['label'] != null &amp;&amp; $crumb['url'] != null &amp;&amp; isset($level)){ while(count($this-&gt;crumbs) &gt; $level){ array_pop($this-&gt;crumbs); } if (!isset($this-&gt;crumbs[0]) &amp;&amp; $level &gt; 0){ $this-&gt;crumbs[0]['url'] = "/index.php"; $this-&gt;crumbs[0]['label'] = "Home";} $this-&gt;crumbs[$level] = $crumb;} $_SESSION['breadcrumb'] = $this-&gt;crumbs; $this-&gt;crumbs[$level]['url'] = null;} function output(){ echo "&lt;ul&gt;"; foreach ($this-&gt;crumbs as $crumb){ if ($crumb['url'] != null){ echo "&lt;li&gt; &lt;a href='".$crumb['url']."' title='".$crumb['label']."'&gt;".$crumb['label']."&lt;/a&gt;&lt;/li&gt; ";} else { echo "&lt;li class='last'&gt;".$crumb['label']."&lt;/li&gt; ";}} echo "&lt;/ul&gt;";}} ?&gt; </code></pre> <p>Each page begins with something like:</p> <pre><code> &lt;?php session_start(); $level= '1'; $label= 'Honors Circle'; $url= '/honors/'; include($_SERVER['DOCUMENT_ROOT']."/includes/Breadcrumb.php"); $trail = new Breadcrumb(); $trail-&gt;add($label, $url, $level); ?&gt; </code></pre> <p>or </p> <pre><code>&lt;?php session_start(); $level= '2'; $label= 'Districts'; $url= '/honors/district.php'; include($_SERVER['DOCUMENT_ROOT']."/includes/Breadcrumb.php"); $trail = new Breadcrumb(); $trail-&gt;add($label, $url, $level); ?&gt; </code></pre> <p>And to print the breadcrumb trail:</p> <pre><code>&lt;div id="breadcrumb"&gt;&lt;?php $trail-&gt;output(); ?&gt;&lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload