The only way to let your users/visitors know about where they are or what is the full path of the current page they are visitting is to display the Breadcrumb Links in your website. By displaying this Breadcrumb Links, in addition they will not be lost about the location where they are, your users also will be easily jump to the certain parent page link of the current page, especially if your menu structure has more than one levels. Unfortunately, PHPMaker has not provided this Breadcrumb Links feature until version 9.0.1.
I have successfully customized the PHPMaker template in order to implement this breadcrumb links feature in most of pages that generated by PHPMaker 9.0.1. You are also able to display or hide (disable/enable) this Breadcrumb links by simply adjusting the related constant value in your configuration (ewcfg9.php) file. Not only that, the style of the Breadcrumb Links that will be displayed looks simple, yet so nice and modern. This will make your website will look smarter and more professional for your users or visitors.
Another good news that you need to know is that you are able now to create unlimited Breadcrumb Links levels, as well as the unlimited menu levels you may create that provided by PHPMaker itself. Not only that, you are also now able to display the current page title in your title bar of your browser. For example, your current page title is “Customers List” and your web application title is “My Online Shop”. Instead of displaying “My Online Shop” only in the browser’s title bar as the current condition that provided by PHPMaker, now you are able to display Customers List « My Online Shop in your title bar of the browser. This Breadcrumb Links also supports for multi language.
All we have to do is customizing the PHPMaker template files and the .xml language files. In other words, we do not modify any generated script files. Unlike the modification I created in version 8, in version 9 the phrases for the breadcrumb links have been separated from the global phrases. This is very useful if you want distinguish the phrases that belong to breadcrumb and the phrases that belong to project and the others.
Updated on May 30, 2012: This customization has been implemented in PHPMaker version 9.0.2, it matches to each other, and as a result, it works properly.
Updated on July 21, 2012: This customization has been implemented in PHPMaker version 9.0.3, it matches to each other, and as a result, it works properly.
Updated on September 4, 2012: This customization has been implemented in PHPMaker version 9.0.4, it matches to each other, and as a result, it works properly.
Updated on November 28, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.
Updated on February 9, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
Updated on June 17, 2013: This customization below has been handled by using MasinoFixedWidthSite extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.
[hidepost]
- First of all, please follow this article or this article in order to create the breadcrumblinks table structure including the three Stored Procedures (SP) that you will need to populate the Breadcrumb Links records. Afterwards, insert your Breadcrumb Links record by using the addnewbreadcrumb SP.
-
Next step, open your \Script\ewcfg.php file, and find this code:
// General
before that line, please insert the following code:
// Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 define("MS_SHOW_BREADCRUMB_IN_ALL_PAGES", TRUE, TRUE); // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 -
Open your \Script\add-script.php file, and find this code:
<!--##session htmtable##-->
after that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\list-script.php file, and find this code:
if ($<!--##=gsTblVar##-->->getCurrentMasterTable() == $<!--##=gsTblVar##-->->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "="; ?>
after the last line of that code, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php if (isset($_GET["showmaster"])) { $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".$_GET["showmaster"]."') ORDER BY C.Lft"; // showmaster, in order to get the full path of the master record!, modified by Masino Sinaga, January 27, 2012 } else { $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; } $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Still in the \Script\list-script.php file, find again this code:
<!--## if (bGridAdd) { ##--> } <!--## } ##--> ?>after the last line of that code, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\search-script.php file, find this code:
<!--##session htmtable##-->
after that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\view-script.php file, find this code:
<!--##session htmtable##-->
after that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\edit-script.php file, find this code:
<!--##session htmtable##-->
after that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\delete-script.php file, find this code:
$<!--##=sPageObj##-->->Page_Terminate("<!--##=sFnList##-->"); // Return to list } ?>after the last line of that code, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\update-script.php file, find this code:
<!--##session htmtable##-->
after that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\changepwd.php file, find this code (only if you are using PHPMaker <= 9.0.3):
[code lang="php"]
// requires js validation
.ValidateRequired = true;
.ValidateRequired = false;
[/code]or if you are using PHPMaker >= 9.0.4, then find the following code:
// requires js validation <?php if (EW_CLIENT_VALIDATE) { ?> <!--##=sFormName##-->.ValidateRequired = true; <?php } else { ?> <!--##=sFormName##-->.ValidateRequired = false; <?php } ?> </script>after the last line of that code, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\userpriv.php file, find this code:
<!--##session htmtable##-->
after that line, please insert this following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home' /></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your \Script\phpcommon-scripts.php file, and find this code:
$<!--##=sPageObj##-->->Page_Main();
after that line, please insert the following code:
// Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 getCurrentPageTitle(ew_CurrentPage()); // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012
-
Open your \Script\template.php file, and find this code:
<title><?php echo $Language->ProjectPhrase("BodyTitle") ?></title>then replace with the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <title><?php global $CurrentPageTitle; echo $CurrentPageTitle; ?></title> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?>
-
Open your \Script\ewshared.php file, and find this code:
// Get node attribute function GetNodeAtt($Nodes, $Att) { $value = ($Nodes) ? $this->Phrases->GetAttribute($Nodes, $Att) : ""; //return ew_ConvertFromUtf8($value); return $value; }after the last line of that code, please insert the following code:
// Begin of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 25, 2012 // Get breadcrumb phrase function BreadcrumbPhrase($Id) { if (is_object($this->Phrases)) { return $this->GetNodeAtt($this->Phrases->SelectSingleNode("//breadcrumb/phrase[@id='" . ($Id) . "']"), "value"); } elseif (is_array($this->Phrases)) { return ew_ConvertFromUtf8(@$this->Phrases['ew-language']['breadcrumb']['phrase'][($Id)]['attr']['value']); } } // Set breadcrumb phrase function setBreadcrumbPhrase($Id, $Value) { if (is_array($this->Phrases)) { $this->Phrases['ew-language']['breadcrumb']['phrase'][($Id)]['attr']['value'] = $Value; } } // End of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 25, 2012 -
Open your \Script\userfn.php file, and find this code:
?> <!--##/session##-->
before the first line of that code, please insert the following code:
// Begin of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 25, 2012 function getCurrentPageTitle($pt) { global $CurrentPageTitle, $conn, $Language; $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".$pt."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); if ($recCount>0) { $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { // $CurrentPageTitle = 'Home'; // skip this! } else { // $CurrentPageTitle .= " » ". $Language->Phrase($rs->fields("Page_Title")).""; // skip this! } } else { // this is the current page, just display this, no need to display its parent! $CurrentPageTitle .= $Language->BreadcrumbPhrase($rs->fields("Page_Title"))."". " « " . $Language->ProjectPhrase("BodyTitle"); return; } $i++; $rs->MoveNext(); } $rs->Close(); } else { $CurrentPageTitle = $Language->ProjectPhrase("BodyTitle"); } } // End of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, May 25, 2012 -
Now we are going also to add the Breadcrumb Links in the blank page. To do this, open \Script\blankpage.php file, and find this code:
<!--##include phpcommon.php/phpcommon-message##-->
before that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> <?php if (MS_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="breadcrumbcontainer"> <ul id="breadcrumb"> <?php $sSql = "SELECT C.* FROM breadcrumblinks AS B, breadcrumblinks AS C WHERE (B.Lft BETWEEN C.Lft AND C.Rgt) AND (B.Page_URL LIKE '".ew_CurrentPage()."') ORDER BY C.Lft"; $rs = $conn->Execute($sSql); $recCount = $rs->RecordCount(); $rs->MoveFirst(); $i = 1; while (!$rs->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rs->fields("Page_URL")."' title='".$Language->BreadcrumbPhrase("Home")."'><img src='./phpimages/home.png' alt='".$Language->BreadcrumbPhrase("Home")."' class='home'></a></li>"; } else { echo "<li><a href='". $rs->fields("Page_URL")."'>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$Language->BreadcrumbPhrase($rs->fields("Page_Title"))."</li>"; } $i++; $rs->MoveNext(); } $rs->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, May 4, 2012 ?> -
Open your C:\Program Files\PHPMaker 9\themes\ew.css file, and find this code:
/*END_SYSTEM_STYLES*/
before that line, please insert the following code:
/* Begin of Customizing Breadcrumb Links, by Masino Sinaga, May 2, 2012 */ #breadcrumb { font: 8pt Tahoma, Helvetica, sans-serif; background-image:url(../phpimages/bc_bg.png); background-repeat:repeat-x; height:22px; line-height:22px; color:#9b9b9b; border-left: 1px solid #cacaca; border-right: 1px solid #cacaca; border-top: 1px solid #cacaca; overflow:hidden; margin:0px; padding:0px; } #breadcrumb li { list-style-type:none; float:left; padding-left:1px; } #breadcrumb a { height:22px; display:block; background-image:url(../phpimages/bc_separator.png); background-repeat:no-repeat; background-position:right; padding-right: 10px; text-decoration: none; color:#454545; } .home { border:none; margin: 3px 0px; } #breadcrumb a:hover { color:#35acc5; } /* End of Customizing Breadcrumb Links, by Masino Sinaga, May 2, 2012 */ - Download this file (there are three files inside; they are: bc_bg.png, bc_separator.png, and home.png). Extract them to your /Script/images/ sub directory of your current template. These three files are needed in order to display the Breadcrumb Links style more beautiful and professional. Make sure you do not miss this step in order to display the Breadcrumb Links properly.
-
In order to support for multi language, you have to define/add all phrases that you had in your Page_Title field of breadcrumblinks table into your .xml language files that located in C:\Program Files\PHPMaker 9\languages\ folder.
Define all of your breadcrumb links phrases after the following line in your .xml language files:<ew-language date="2012/5/12" version="9.0.0.1" id="en" name="English" desc="English" author="e.World Technology Ltd.">
For example, one of your phrases in Page_Title field of the breadcrumblinks table is “Customers List”, so define it into the english.xml file as following (just make the values in id and value are same for the simplicity):
<breadcrumb> <phrase id="Customers List" value="Customer Lists"/> </breadcrumb>
Please note that if you want to add the new phrase, then you have to insert it between
<breadcrumb>
and
</breadcrumb>
tags.
- Re-generate all of your the related script files. Now the Breadcrumb Links should be displayed in the related page you defined in the breadcrumblinks table. Also, the current page title should be displayed in your title bar of your browser. Make sure you get this great advantage after implementing the customization.
[/hidepost]
Would be great if you can show the final result, as a screenshot or maybe a screencast…considering it’s a lot of work to implement the breadcrumb. Thanks
You may see the screencast via this link.
My project will not regenerate after adding the breadcrumb tags to the .xml file. I get this error:
PHPMaker – Error in loading the language file ‘english.xml’. Generation aborted.
Make sure you have included or given the chekced mark at the “english.xml” item under “Other files” in “Generate” window before generating the script files. Also, make sure there is no html tag inside the value of the phrase in the english.xml language file.
In other words, be reminded that in an XML file, you need to escape the value of
with
instead.
Another case: replace
with
That was it! Thanks, Masino.
Spoke too fast – now have another issue.
If I start a new project and upload the script files, the app can’t start. I get:
Call to a member function RecordCount() on a non-object in /var/www/web/userfn9.php on line 25
Make sure you have created the breadcrumblinks table in your database. Please read the instruction in the first step above.