public function initialize() { if (qa_opt('hw_enable_iflychat')) { //enable iflychat //moved to 'before_render_page' hook global $iflychat_userinfo; global $hw_iflychat; //iflychat instance if (!empty($iflychat_userinfo)) { $userdedetail = $iflychat_userinfo->getUserDetails(); $iflychat_settings = new iFlyChatSettings(); $hw_iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $userdedetail); $this->ifly_html_code = $hw_iflychat->getHtmlCode(); } } }
* Ensure that path to iFlyChat PHP SDK files are correct * **/ require_once './iflychatsettings.php'; require_once './iflychatuserdetails.php'; require_once './iflychat.php'; /** * * Use iFlyChat class get_html_code() function to render chat HTML code. * This code should be printed on all pages where you want chat to be present. * **/ global $iflychat_userinfo; $iflychat_settings = new iFlyChatSettings(); $iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails()); $ifly_html_code = $iflychat->getHtmlCode(); ?> <html> <head> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> </head> <body> <h1>How to include iFlyChat code in a sample PHP page?</h1> <!-- iFlyChat code begins --> <?php print $ifly_html_code; ?> <!-- iFlyChat code ends --> <br>