Now we are going to customize the look of the Header and Footer of your web applications that generated by PHP Report Maker 6. This customization is similar to the earlier one I made for PHP Maker. There are some constants that were added into the configuration file that aims to support the change of your Header and Footer view. Most of information that we will add to the Header and Footer is the common functionality that usually exists in a web application. They are controlled by the usage of the related constants. In other words, you are able to change the default value of the constants that suits with your needs.
Some of these constants are for:
- Displaying or hiding the entire header
- Displaying or hiding the entire footer
- Displaying or hiding site title in header
- Displaying or hiding current Username in header
- Displaying or hiding the Languages Selector (whether "in the header", "below the header", or "hide them all")
- Text-alignment for Site Title, current Username, and Languages Selector
- Displaying the style of Site Title (whether "normal", "capitalize", or "uppercase")
- Logo width setting (this will adjust the space between logo image and Site Title, current Username, and Languages Selector)
- The Language Selector alignment (whether “autoadjust”, "left", "center", or "right")
- Displaying or hiding the copyright text on Footer
- Displaying or hiding the "Back to Top" link on Footer
- Displaying or hiding the "Terms and Conditions" link on footer
All we have to do is customizing PHP Report Maker template files. In other words, we will not modify the generated script files. After implementing this modifications, now you can customize your Header and Footer and the related items by simply changing the value of the related constants in the configuration file.
[hidepost]
-
Open your \Script\rpt-config.php file, and find this code:
// General
before that line, please insert the following code:
// Begin of modification Customize Header and Footer, by Masino Sinaga, December 4, 2012 define("MSR_LANGUAGE_SELECTOR_VISIBILITY", "inheader", TRUE); // Whether "inheader", "belowheader", or "hidethemall" define("MSR_LANGUAGE_SELECTOR_ALIGN", "autoadjust", TRUE); // Language selector align: "autoadjust", "left", "center", or "right" define("MSR_SHOW_SITE_TITLE_IN_HEADER", TRUE, TRUE); // Show Site title in header define("MSR_SHOW_CURRENT_USER_IN_HEADER", TRUE, TRUE); // Show current User status in header define("MSR_SHOW_ENTIRE_HEADER", TRUE, TRUE); // Show entire header block define("MSR_SHOW_ENTIRE_FOOTER", TRUE, TRUE); // Show entire footer block define("MSR_SHOW_TEXT_IN_FOOTER", TRUE, TRUE); // Show text in footer block define("MSR_TEXT_ALIGN_IN_HEADER", "left", TRUE); // Text align in header, left, center, or right define("MSR_SITE_TITLE_TEXT_STYLE", "normal", TRUE); // Whether "normal", "capitalize", or "uppercase" define("MSR_LOGO_WIDTH", 170, TRUE); // Logo width define("MSR_SHOW_BACKTOTOP_ON_FOOTER", TRUE, TRUE); // Back to Top link define("MSR_SHOW_TOC_ON_FOOTER", TRUE, TRUE); // Terms of Condition // End of modification Customize Header and Footer, by Masino Sinaga, December 4, 2012
-
Open your C:\Program Files\PHP Report Maker 6\languages\english.xml file, and find this code:
</global>
before that line of code, please insert the following code:
<phrase id="Welcome" value="Welcome"/> <phrase id="AskToLogout" value="Are you sure you want to logout now?"/> <phrase id="BackToTop" value="Back to Top"/> <phrase id="UserID" value="User ID"/> <phrase id="TaCTitle" value="Terms and Conditions"/>
Do the same way to your another .xml language file, for example, I am using Indonesian language too, so I add this following code into my indonesian.xml file:
<phrase id="Welcome" value="Selamat Datang"/> <phrase id="AskToLogout" value="Anda yakin ingin logout sekarang?"/> <phrase id="BackToTop" value="Kembali ke Atas"/> <phrase id="UserID" value="ID Pengguna"/> <phrase id="TaCTitle" value="Syarat dan Ketentuan"/>
- Download scroll.zip file, and then extract it. There is one file inside named scroll.js. Put this scroll.js file into your C:\Documents and Settings\{YourName}\My Documents\PHPReportMaker\Templates\phprpt60.zip\Script directory. Afterwards, re-generate your script files using PHP Report Maker as usual.
-
Open your \Script\control.xml file, and find this code:
<!-- copy all js --> <control id="ewr.js" type="copy" ofolderid="_js" ofile="ewr6" oext="js" ifiles="ewr.js" />
before the first line of that code, please insert the following code:
<!-- Added by Masino Sinaga, for Scroll to Top, December 4, 2012 --> <control id="scroll.js" type="copy" remark="Copy scroll.js" ofolderid="_js" ifiles="scroll.js" />
-
Open your \Script\rpt-template.php file, and find this code:
<script type="text/javascript">if (!window.jQuery) ewr_GetScript("<?php echo ewr_jQueryFile("jquery-%v.min.js") ?>");</script>
after that line, please insert the following code:
<?php // Begin of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?> <script type="text/javascript" src="<!--##=ew_GetFileNameByCtrlID("scroll.js")##-->"></script> <?php // End of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?>
-
Still in your \Script\rpt-template.php file, find again this code:
<div class="ewHeaderRow"><!--##=SYSTEMFUNCTIONS.HeaderLogo()##--></div>
then replace it with the following code:
<?php // Begin of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?> <?php if (MSR_SHOW_ENTIRE_HEADER) { // begin of show header block ?> <!-- header (begin) --> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="ewHeaderRow"> <td width="<?php echo (MSR_LOGO_WIDTH); ?>px" rowspan="3"> <?php echo '<a href="." title="'.$ReportLanguage->ProjectPhrase("BodyTitle").'"><!--##=SYSTEMFUNCTIONS.HeaderLogo()##--></a>'; ?> </td> <td> <?php if (MSR_SHOW_SITE_TITLE_IN_HEADER) { ?> <font class="ewFooterText"><strong><div align="<?php echo MSR_TEXT_ALIGN_IN_HEADER; ?>" style="text-transform:<?php echo MSR_SITE_TITLE_TEXT_STYLE; ?>"><?php echo $ReportLanguage->ProjectPhrase("BodyTitle") ?> </div></strong></font> <?php } ?> </td> </tr> <tr class="ewHeaderRow"> <td > <?php if (MSR_SHOW_CURRENT_USER_IN_HEADER) { ?> <font class="ewFooterText"><div align="<?php echo MSR_TEXT_ALIGN_IN_HEADER; ?>"><?php if ($Security->IsLoggedIn()=="login") { echo "". $ReportLanguage->Phrase("UserID").": <strong>" . $Security->CurrentUserName() . "</strong>, [ <a id=\"logout\" href=# onclick=\"MGJS.goTop();return false;\">Logout</a> ]"; } ?> </div></font> <?php } ?> </td> </tr> <tr class="ewHeaderRow"> <td> <!--## if (bMultiLanguage && arLanguageFile.length > 1) { ##--> <?php if (MSR_LANGUAGE_SELECTOR_VISIBILITY=="inheader") { ?> <div align="<?php if (MSR_LANGUAGE_SELECTOR_ALIGN=="autoadjust") { echo MSR_TEXT_ALIGN_IN_HEADER; } else { echo MSR_LANGUAGE_SELECTOR_ALIGN; } ?>"><form class="ewForm"> <span class="phpmaker"><?php echo $ReportLanguage->Phrase("Language") ?></span> <select id="language" name="language" onchange="ewr_SubmitLanguageForm(this.form);"> <?php foreach ($EWR_LANGUAGE_FILE as $langfile) { ?> <option value="<?php echo $langfile[0] ?>"<?php if ($gsLanguage == $langfile[0]) echo " selected=\"selected\"" ?>><?php echo $langfile[1] ?></option> <?php } ?> </select> </form></div> <?php } ?> <!--## } ##--> </td> </tr> </table> <!-- header (end) --> <?php } else { // else of show entire header ?> <div class="ewHeaderRow"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="ewHeaderRow"> <td rowspan="2"> </td> <td> </td> </tr> <tr class="ewHeaderRow"> <td > </td> </tr> </table> </div> <?php } // end of show entire header ?> <?php // End of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?>
-
Still in that \Script\rpt-template.php file, find again this code:
<!--## if (bMultiLanguage) { ##--> <div class="ewLangForm"><form class="ewForm"> <span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Language") ?></span> <select id="language" name="language" class="phpreportmaker" onchange="ewr_SubmitLanguageForm(this.form);"> <?php foreach ($EWR_LANGUAGE_FILE as $langfile) { ?> <option value="<?php echo $langfile[0] ?>"<?php if ($gsLanguage == $langfile[0]) echo " selected=\"selected\"" ?>><?php echo $langfile[1] ?></option> <?php } ?> </select> </form></div> <!--## } ##-->
then replace it with the following code:
<?php // Begin of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?> <!--## if (bMultiLanguage && arLanguageFile.length > 1) { ##--> <?php if (MSR_LANGUAGE_SELECTOR_VISIBILITY=="belowheader") { ?> <div class="ewLangForm" align="<?php if (MSR_LANGUAGE_SELECTOR_ALIGN=="autoadjust") { echo MSR_TEXT_ALIGN_IN_HEADER; } else { echo MSR_LANGUAGE_SELECTOR_ALIGN; } ?>"><form class="ewForm"> <span class="phpreportmaker"><?php echo $ReportLanguage->Phrase("Language") ?></span> <select id="language" name="language" onchange="ewr_SubmitLanguageForm(this.form);"> <?php foreach ($EWR_LANGUAGE_FILE as $langfile) { ?> <option value="<?php echo $langfile[0] ?>"<?php if ($gsLanguage == $langfile[0]) echo " selected=\"selected\"" ?>><?php echo $langfile[1] ?></option> <?php } ?> </select> </form></div> <?php } ?> <!--## } ##--> <?php if (!MSR_SHOW_SITE_TITLE_IN_HEADER) { ?> <p class="phpreportmaker ewTitle"><b><?php echo $ReportLanguage->ProjectPhrase("BodyTitle") ?></b></p> <?php } ?> <?php // End of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?>
-
Still in that \Script\rpt-template.php file, find again this code:
<div class="ewFooterText"> <?php echo $ReportLanguage->ProjectPhrase("FooterText"); ?></div> <!-- Place other links, for example, disclaimer, here -->
then replace it with the following code:
<?php // Begin of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?> <div class="ewFooterText"> <?php if (MSR_SHOW_TEXT_IN_FOOTER) { ?> <?php echo $ReportLanguage->ProjectPhrase("FooterText") ?> <?php } ?> <?php if (MSR_SHOW_BACKTOTOP_ON_FOOTER) { ?> | <a id="gotop" href="#" onclick="MGJS.goTop();return false;"><?php echo $ReportLanguage->Phrase("BackToTop"); ?></a> <?php } ?> <?php if (MSR_SHOW_TOC_ON_FOOTER) { ?> | <a href="#" id="tac" onclick="MGJS.goTop();return false;"><?php echo $ReportLanguage->Phrase("TaCTitle"); ?></a> <?php } ?> </div> <!-- Place other links, for example, disclaimer, here --> <?php // End of modification Header and Footer, by Masino Sinaga, December 4, 2012 ?>
- 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.