Similar to my previous two articles, this time we are going to improve the Terms and Conditions feature in websites that generated by PHPMaker. Now we will switch it become using YUI Panel widget, so the Help window will look more professional and more beautiful. Please note that before implementing the customization below, I assume you have implemented the related customization from my article How to Customize Header and Footer in Websites that Created with PHPMaker 9.0.1. If not, then do it first now!
Updated on February 10, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.
[hidepost]
-
Open your \Script\ewcfg.php file, and find this code:
// General
before that line please insert the following code:
define("MS_LANGUAGES_TABLE", "languages", TRUE);Please note that this MS_LANGUAGES_TABLE is a constant for defining the languages table. It is important to store the information that related to the certain language, especially if you create the multi language/lingual feature for your web application. In this case, we have to handle the Terms and Conditions text also in multi language.
If you don't have that "languages" table, just run the following SQL script:
CREATE TABLE `languages` ( `language_code` char(2) NOT NULL, `language_name` varchar(20) NOT NULL, `default` enum('Y','N') DEFAULT 'N', `site_logo` varchar(100) NOT NULL, `site_title` varchar(100) NOT NULL, `default_thousands_separator` varchar(5) DEFAULT NULL, `default_decimal_point` varchar(5) DEFAULT NULL, `default_currency_symbol` varchar(10) DEFAULT NULL, `default_money_thousands_separator` varchar(5) DEFAULT NULL, `default_money_decimal_point` varchar(5) DEFAULT NULL, `terms_of_condition_text` text NOT NULL, `announcement_text` text NOT NULL, PRIMARY KEY (`language_code`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;afterwards, insert your related data at sufficiently.
-
Open your \Script\template.php file, and find this code:
</style>
before that line, please insert the following code:
#tacpanel .bd { overflow:auto; background-color:fff; padding:10px; } #tacpanel .ft { height:18px; padding:0; } #tacpanel .yui-resize-handle-br { right:0; bottom:0; height: 8px; width: 8px; position:absolute; } -
Still in that \Script\template.php file, find again this code:
</head>
before that line, please insert the following code:
<?php if (MS_LANGUAGES_TABLE != "") { global $conn; $sSql = "SELECT terms_of_condition_text FROM ".MS_LANGUAGES_TABLE." WHERE language_code = '".$gsLanguage."'"; $rs = $conn->Execute($sSql); $tactitle = $Language->Phrase("tactitle"); if ($rs->RecordCount() > 1) { $taccontent = $rs->fields("terms_of_condition_text"); } else { $taccontent = $Language->Phrase("TaCContent"); } } else { $tactitle = $Language->Phrase("tactitle"); $taccontent = $Language->BreadcrumbPhrase("TACNotAvailable"); } $aboutus = $Language->Phrase("AboutUs"); $asktologout = $Language->Phrase("AskToLogout"); $yes = $Language->Phrase("Yes"); $no = $Language->Phrase("No"); ?> <script type="text/javascript"> YAHOO.util.Event.onDOMReady(function(){var b=new YAHOO.widget.Panel("tacpanel",{draggable:true,visible:false,width:"500px",height:"450px",autofillheight:"body",constraintoviewport:true,context:["paneltac","tl","bl"]});b.render();b.setHeader("<?php echo $tactitle; ?>");b.setBody("<?php echo $taccontent; ?>");var a=new YAHOO.util.Resize("tacpanel",{handles:["br"],autoRatio:false,minWidth:400,minHeight:350,status:false});a.on("startResize",function(c){if(this.cfg.getProperty("constraintoviewport")){var d=YAHOO.util.Dom;var f=d.getClientRegion();var e=d.getRegion(this.element);a.set("maxWidth",f.right-e.left-YAHOO.widget.Overlay.VIEWPORT_OFFSET);a.set("maxHeight",f.bottom-e.top-YAHOO.widget.Overlay.VIEWPORT_OFFSET)}else{a.set("maxWidth",null);a.set("maxHeight",null)}},b,true);a.on("resize",function(c){var d=c.height;this.cfg.setProperty("height",d+"px")},b,true);YAHOO.util.Event.on("tac","click",b.show,b,true)}); </script> -
Still in that \Script\template.php file, find again this code:
<a href="javascript:popupWindow('toc.php')"><?php echo $Language->Phrase("TaCTitle"); ?></a>then replace it with the following code:
<a href="#" id="tac" onclick="MGJS.goTop();return false;"><?php echo $Language->Phrase("TaCTitle"); ?></a> - Finally, re-generate your script files using PHPMaker as always.
[/hidepost]
Leave a Reply
You must be logged in to post a comment.