We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27449
    • 211 Posts
    ok...
    I need put urgently the chat to work and I don’t know what is happen huh



    And the snippet I have this code:
    global $modx;
    $snipPath = $modx->config["base_path"]."assets/snippets/";
    include_once($snipPath . "/phpfreechat/src/phpfreechat.class.php");

    // You can configure PHP Free Chat by setting variables below. See the PHP Free Chat
    // documentation for options.

    $params = array();
    $params["title"] = "Chat Room";
    $params["refresh_delay"] = 2000; // 2000ms = 2s
    $params["nick"] = "guest".rand(1,1000); // setup the intitial nickname
    $params["isadmin"] = true; // just for debug wink
    $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
    $chat = new phpFreeChat( $params );

    // register chat javascript and css
    $modx->regClientStartupScript($chat->printJavascript());
    $modx->regClientCSS($chat->printStyle());

    return $chat->printChat();


    I don’t know what do I to do!!!!
    Can you help me?
      • 26903
      • 1,336 Posts
      OK, I think its because you have no template for it on the page, I downloaded it and from the file index.php in its top level nicked the html and created this template called freechat and assigned it to the free chat page :-
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
      <html>
       <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>phpFreeChat- Sources Index</title>
        <link rel="stylesheet" title="classic" type="text/css" href="http://localhost/phpfreechat-1.2/style/generic.css" />
        <link rel="stylesheet" title="classic" type="text/css" href="http://localhost/phpfreechat-1.2/style/header.css" />
        <link rel="stylesheet" title="classic" type="text/css" href="http://localhost/phpfreechat-1.2/style/footer.css" />
        <link rel="stylesheet" title="classic" type="text/css" href="http://localhost/phpfreechat-1.2/style/menu.css" />
        <link rel="stylesheet" title="classic" type="text/css" href="http://localhost/phpfreechat-1.2/style/content.css" />  
       </head>
       <body>
      
      <div class="header">
            <h1>phpFreeChat - Sources Index</h1>
            <img alt="logo bulle" src="http://localhost/phpfreechat-1.2/style/bulle.gif" class="logo2" />
      </div>
      
      <div class="menu">
            <ul>
              <li class="sub title">General</li>
              <li>
                <ul class="sub">
                  <li class="item">
                    <a href="demo/">Demos</a>
                  </li>
                  <?php if (file_exists(dirname(__FILE__)."/checkmd5.php")) { ?>
                  <li>
                    <a href="checkmd5.php">Check md5</a>
                  </li>
                  <?php } ?>
                  <!--
                  <li class="item">
                    <a href="admin/">Administration</a>
                  </li>
                  -->
                </ul>
              </li>
              <li class="sub title">Documentation</li>
              <li>
                <ul>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/overview">Overview [en]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/fr/overview">Overview [fr]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/es/overview">Overview [es]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/zh/overview">Overview [zh]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/ar/overview">Overview [ar]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/quickstart">Quickstart [en]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/fr/quickstart">En avant ! [fr]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/parameters">Parameters list [en]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/faq">FAQ [en]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/fr/faq">FAQ [fr]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/advanced-configuration">Advanced configuration [en]</a>
                  </li>
                  <li class="item">
                    <a href="http://www.phpfreechat.net/fr/advanced-configuration">Configuration avancée [fr]</a>
                  </li>            
                  <li class="item">
                    <a href="http://www.phpfreechat.net/customize">Customize [en]</a>
                  </li>
                </ul>
              </li>
            </ul>
            <p class="partner">
              <a href="http://www.phpfreechat.net"><img alt="phpfreechat.net" src="style/logo_88x31.gif" /></a><br/>
              <a href="http://www.jeu-gratuit.net/">jeu-gratuit</a><br/>
              <a href="http://jeux-flash.jeu-gratuit.net/">jeux-flash</a><br/>
              <a href="http://www.pronofun.com/">pronofun</a><br/>
              <a href="http://areno.jeu-gratuit.net/">areno</a><br/>
              <a href="http://www.micropolia.com/">micropolia</a><br/>
              <a href="http://www.zeitoun.net/">zeitoun</a><br/>
              <a href="http://www.hotscripts.com/?RID=N452772">hotscripts</a><br/>
            </p>
      </div>
      
      <div class="content">
        <?php $chat->printChat(); ?>
        <?php if (isset($params["isadmin"]) && $params["isadmin"]) { ?>
          <p style="color:red;font-weight:bold;">Warning: because of "isadmin" parameter, everybody is admin. Please modify this script before using it on production servers !</p>
        <?php } ?>
      </div>
      
      </body></html>
      


      Notice I changed the css paths etc. this mostly seems to work but you will nedd to do this for your setup, also not sure if you need the last line of the snipprt or not.

      Thinking about it can you not simply iframe your phpfreechat installation into a MODx page with a suitable template?

        Use MODx, or the cat gets it!