Revision [8002]
This is an old revision of WikiBreadcrumb made by GmBowen on 2005-05-11 07:25:13.
add the following code to your header.php file near the bottom (immediately before the last "?>").
// Breadcrumb code V1.0 copyright by GMBowen, 2005. Prepared for a SSHRC funded research project. Licensed under GPL.
// Please keep attributions if distributing code.
$username = $this->GetUserName();
$check = $this->LoadSingle("SELECT recentpages FROM ".$this->config["table_prefix"]."users WHERE name='".$username."'");
$check2 = strpos($check[recentpages], $this->GetPageTag());
$PgNmLength = strlen($this->GetPageTag()." ");
if ($check2 === false) {
$newstring = $check[recentpages].$this->GetPageTag()." ";
} else {
$newstring = substr_replace($check[recentpages], "", $check2, (strlen($this->GetPageTag())+1) );
$newstring = $newstring.$this->GetPageTag()." ";
}
if (str_word_count($newstring) > 6) {$newstring = strstr($newstring, " ");}
$newstring = trim($newstring)." ";
$this->query("UPDATE ".$this->config['table_prefix']."users SET recentpages = '$newstring' WHERE name='$username' ");
$recent = $this->LoadSingle("SELECT recentpages FROM ".$this->config["table_prefix"]."users WHERE name='".$username."'");
$newphrase = str_replace(" ", "-->", trim($recent[recentpages]));
echo "<br /><small><b>Trail:</b> ".$this->format($newphrase)."</small>";
// Please keep attributions if distributing code.
$username = $this->GetUserName();
$check = $this->LoadSingle("SELECT recentpages FROM ".$this->config["table_prefix"]."users WHERE name='".$username."'");
$check2 = strpos($check[recentpages], $this->GetPageTag());
$PgNmLength = strlen($this->GetPageTag()." ");
if ($check2 === false) {
$newstring = $check[recentpages].$this->GetPageTag()." ";
} else {
$newstring = substr_replace($check[recentpages], "", $check2, (strlen($this->GetPageTag())+1) );
$newstring = $newstring.$this->GetPageTag()." ";
}
if (str_word_count($newstring) > 6) {$newstring = strstr($newstring, " ");}
$newstring = trim($newstring)." ";
$this->query("UPDATE ".$this->config['table_prefix']."users SET recentpages = '$newstring' WHERE name='$username' ");
$recent = $this->LoadSingle("SELECT recentpages FROM ".$this->config["table_prefix"]."users WHERE name='".$username."'");
$newphrase = str_replace(" ", "-->", trim($recent[recentpages]));
echo "<br /><small><b>Trail:</b> ".$this->format($newphrase)."</small>";
If you want the list of previously visited pages to be greater or lesser change the "6" value.
Hope this meets your needs folks. If you find ways of making the code more efficient (and that is certainly possible), then please feel free to update it.