This following customization will display the Breadcrumb Links in websites that generated by PHP Report Maker 6, as well as the similar customization in PHPMaker 9. Please always refer to that article if you want to implement the Breadcrumb Links in your report pages, since there are some important things that you should know regarding how to create breadcrumblinks table in order to store your Breadcrumb Links records.
This customization is very useful if you want to provide your web application users the information about the page location they are visitting. In addition, this is also useful if you want to integrate your report pages that generated by PHP Report Maker 6 into your web applications that generated by PHPMaker 9 and you want to synchronize the look and view of your web applications between one to another. Just like the customization in PHPMaker, we will also customize PHP Report Maker template files. In other words, we will not modify any generated web files.
Please note that in some part of the customization below is related to the customization in article Customizing Page Title Style in Websites that Generated by PHP Report Maker 6.0.0. So, please implement the customization in that article above before doing the customization below.
[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.
-
Open your \Script\rpt-config.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, December 3, 2012 define("MSR_SHOW_BREADCRUMB_IN_ALL_PAGES", TRUE, TRUE); // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012
-
Open your \Script\rpt-summary.php file, and find this code:
<?php // Begin of modification Customize Page Title Style, by Masino Sinaga, December 3, 2012 ?>
before that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 ?> <?php if (MSR_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="ewBreadcrumbContainer"> <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 '".ewr_CurrentPage()."') ORDER BY C.Lft"; $rsBreadcrumb = $conn->Execute($sSql); $recCount = $rsBreadcrumb->RecordCount(); $rsBreadcrumb->MoveFirst(); $i = 1; while (!$rsBreadcrumb->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rsBreadcrumb->fields("Page_URL")."' title='".$ReportLanguage->BreadcrumbPhrase("Home")."'><img src='./phprptimages/home.png' alt='".$ReportLanguage->BreadcrumbPhrase("Home")."' class='home'></a></li>"; } else { echo "<li><a href='". $rsBreadcrumb->fields("Page_URL")."'>".$ReportLanguage->BreadcrumbPhrase($rsBreadcrumb->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$ReportLanguage->BreadcrumbPhrase($rsBreadcrumb->fields("Page_Title"))."</li>"; } $i++; $rsBreadcrumb->MoveNext(); } $rsBreadcrumb->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 ?>
-
Open your \Script\rpt-crosstab.php file, and find this code:
<?php // Begin of modification Customize Page Title Style, by Masino Sinaga, December 3, 2012 ?>
before that line, please insert the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 ?> <?php if (MSR_SHOW_BREADCRUMB_IN_ALL_PAGES) { ?> <span> <div id="ewBreadcrumbContainer"> <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 '".ewr_CurrentPage()."') ORDER BY C.Lft"; $rsBreadcrumb = $conn->Execute($sSql); $recCount = $rsBreadcrumb->RecordCount(); $rsBreadcrumb->MoveFirst(); $i = 1; while (!$rsBreadcrumb->EOF) { if ($i < $recCount) { if ($i==1) { echo "<li><a href='". $rsBreadcrumb->fields("Page_URL")."' title='".$ReportLanguage->BreadcrumbPhrase("Home")."'><img src='./phprptimages/home.png' alt='".$ReportLanguage->BreadcrumbPhrase("Home")."' class='home'></a></li>"; } else { echo "<li><a href='". $rsBreadcrumb->fields("Page_URL")."'>".$ReportLanguage->BreadcrumbPhrase($rsBreadcrumb->fields("Page_Title"))."</a></li>"; } } else { echo "<li>".$ReportLanguage->BreadcrumbPhrase($rsBreadcrumb->fields("Page_Title"))."</li>"; } $i++; $rsBreadcrumb->MoveNext(); } $rsBreadcrumb->Close(); ?> </ul> </div> </span> <?php } ?> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 ?>
-
Open your \Script\phprptfn.php file, and find this code:
// Get menu phrase function MenuPhrase($MenuId, $Id) {
before the first line of that code, please insert the following code:
// Begin of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, December 3, 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 ewr_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, December 3, 2012
-
Open your \Script\rpt-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, December 3, 2012 function getCurrentReportPageTitle($pt) { global $CurrentPageTitle, $conn, $ReportLanguage; $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"; $rsBreadcrumb = $conn->Execute($sSql); $recCount = $rsBreadcrumb->RecordCount(); if ($recCount>0) { $rsBreadcrumb->MoveFirst(); $i = 1; while (!$rsBreadcrumb->EOF) { if ($i < $recCount) { if ($i==1) { // $CurrentPageTitle = 'Home'; // skip this! } else { // $CurrentPageTitle .= " » ". $Language->Phrase($rsBreadcrumb->fields("Page_Title")).""; // skip this! } } else { // this is the current page, just display this, no need to display its parent! $CurrentPageTitle .= $ReportLanguage->BreadcrumbPhrase($rsBreadcrumb->fields("Page_Title"))."". " « " . $ReportLanguage->ProjectPhrase("BodyTitle"); return; } $i++; $rsBreadcrumb->MoveNext(); } $rsBreadcrumb->Close(); } else { $CurrentPageTitle = $ReportLanguage->ProjectPhrase("BodyTitle"); } } // End of modification Displaying Breadcrumbs in All Pages, by Masino Sinaga, December 3, 2012
-
Open your \Script\rpt-template.php file, and find this code:
<title><?php echo $ReportLanguage->ProjectPhrase("BodyTitle") ?></title>
then replace it with the following code:
<?php // Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 ?> <title><?php global $CurrentPageTitle; echo $CurrentPageTitle; ?></title> <?php // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 ?>
-
Open your \Script\rpt-phpcommon-scripts.php file, and find this code:
// Page main $<!--##=gsPageObj##-->->Page_Main();
before the first line of that code, please insert the following code:
// Begin of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 2012 getCurrentReportPageTitle(ewr_CurrentPage()); // End of modification Displaying Breadcrumb Links in All Pages, by Masino Sinaga, December 3, 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, December 3, 2012 */ #breadcrumb { font: 8pt Tahoma, Helvetica, sans-serif; background-image:url(../phprptimages/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(../phprptimages/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, December 3, 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 PHP Report Maker 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\PHP Report Maker 6\languages\ folder.
Define all of your breadcrumb links phrases after the following line in your .xml language files:<ew-language date="2012/11/7" version="6.0.0" 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 Report”, 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 Report" value="Customers Report"/> </breadcrumb>
Please note that if you want to add the new phrase, then you have to insert it between
<breadcrumb>
and
</breadcrumb>
tags.
- Another important thing that you should know is you have to insert your Breadcrumb Links record into breadcrumblinks table, just like we did for PHPMaker customization. See the first step in that article above.
- Finally, re-generate your script files using PHP Report Maker as always.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.