0

I print Javascript functions to open bottom log area by a PHP script. This crashes non-dom scripts like Ajax, Excel generation etc. is there a server side dom function like isDom() in PHP?

Current Script:

if (System::$isDebug == 1 && self::$_registeredJsFunctions == false)
        $this->registerJsFunctions();

registerJsFunction:

protected function registerJsFunctions() {

    self::$_registeredJsFunctions = true;

    echo <<<EOD


  <script type="text/javascript">
        function printSystemLog(msg) {
            if (!document.getElementById('ie-log')) {
                $(document.body).append('<style type="text/css">'
                + '#ie-log { z-index:9999 !important; position:fixed; bottom:0;  border-top: double 2px #939399; background:none #FDFDF0;width:100%;font-size:11px; font-family: "Courier New", Courier, monospace;overflow:hidden;}'
                + '#ie-log #debug-level { position: absolute; height: 25px; right:0px; top:0; width: auto; background:#ECF1EF; padding: 2px; color:#8B8378; z-index:9999;border: double 2px #939399;border-top: none;}'
                + '#ie-log #larea{ height:180px;padding:3px;overflow-y:scroll !important; overflow-x:hidden !important; }'
                + '#ie-log #lclose{ margin-left: 16px;}'
                + '#ie-log h3 { margin: 8px 5px; }'
                + '#ie-log #lclose a { padding: 3px; padding-left:17px; background:url(theme/standart/images/delete.png) left center no-repeat; color:inherit;}'
                + '#ie-log #lclose a:hover { background-color:#F1EDC2; text-decoration:none; color: #8B6914;}'
                + '#larea div.log-row { position:relative; margin: 3px 10px; border-bottom: solid thin #C4C49C; margin-left:20px; overflow: visible !important; }'
                + '#larea div.log-row span.arrright {position:absolute; height:16px; left: -20px; display:inline-block; width:16px; background: transparent url(theme/standart/images/arrow_right.png) left center no-repeat;} '
                + '</style>');
                $(document.body).append('<div id="ie-log"><h3>Sistemin Anlık Log Görüntüsü</h3><div id="debug-level"><span>Seviye: <select onchange="logFilter(this.value)"><option value="">Hepsi</option><option value="EMERG">Emergency</option><option value="ALERT">Alert</option><option value="CRIT">Critical</option><option value="ERR">Error</option><option value="WARN">Warning</option><option value="NOTICE">Notice</option><option value="INFO">İnformation</option><option value="DEBUG">Debug</option></select></span><span id="lclose"><a href="#" onclick="closeLogArea();return false;" title="Çerez atar, bir dahakine açmaz">Kapat</a></span></div><div id="larea"></div></div>');



                if (getCookie('TASARIMICI_LOG_SEVMEZ') == 1)
                    $('#ie-log').hide();
            }
        $('#larea').prepend('<div class="log-row"><span class="arrright"></span>'+msg + '</div>');
    }
</script>
EOD;
    }
René Höhle
  • 26,716
  • 22
  • 73
  • 82
user305015
  • 105
  • 9
  • I am not sure what you are asking but possible duplicate of [How to parse and process HTML with PHP?](http://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php) – Gordon Jun 25 '12 at 08:16
  • What does the code do? `$isDebug`'s meaning I can imagine, but the other stuff? Also, what are the exact problems? Errors on the server side? Broken JS on the client side? – pixelistik Jun 25 '12 at 08:23
  • my purpose is to print log messages under the screen. so i need to echo js functions. but this crashes ajax manuplations – user305015 Jun 25 '12 at 08:44

0 Answers0