Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Error log over header

Asked Modified Viewed 2,469 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

i want to add the Error log message for admins show over my header and footer so that i have not to scroll everytime to see my errors on page. So, i think i found the functuion but when i add this in my files no log will show me.

i found it in /Themes/templates/footer.php
// Error handling
if (iADMIN  && checkrights("ERRO") && count($_errorHandler) > 0) {
   echo "<div class='admin-message'>".str_replace("[ERROR_LOG_URL]", ADMIN."errors.php".$aidlink, $locale['err_101'])."</div>\n";
}

echo "</body>\n</html>\n";

$output = ob_get_contents();
if (ob_get_length() !== FALSE){
   ob_end_clean();
}
echo handle_output($output);

if (ob_get_length() !== FALSE){
   ob_end_flush();
}


can anyone help me? I would it add also as a panel when it is possibel. Thamnx for help
0 replies

3 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

This part is all you need..


// Error handling
if (iADMIN  && checkrights("ERRO") && count($_errorHandler) > 0) {
   echo "<div class='admin-message'>".str_replace("[ERROR_LOG_URL]", ADMIN."errors.php".$aidlink, $locale['err_101'])."</div>\n";
}
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

hmn i have add this on some places but none will show.
i have try the /Themes/templates/header.php and the theme from my actual theme
i see only in footer this errorlog - i think im a noob :) hahaha

function render_page($license = false) {
   
   global $settings, $main_style, $locale;

   //Header


// Error handling
if (iADMIN  && checkrights("ERRO") && count($_errorHandler) > 0) {
   echo "<div class='admin-message'>".str_replace("[ERROR_LOG_URL]", ADMIN."errors.php".$aidlink, $locale['err_101'])."</div>\n";
}

   echo "<table cellpadding='0' cellspacing='0' align='center' width='90%'>\n<tr>\n";
   echo "<td class='full-header'>\n".showbanners()."</td>\n";
   //echo "<td align='right' class='sub-header'><img src='".BASEDIR."werbung/lh.gif'></a></td>\n";
   echo "</tr>\n</table>\n";
   
   echo "<table cellpadding='0' cellspacing='0' align='center' width='90%'>\n<tr>\n";
   echo "<td class='sub-header-left'></td>\n";
   echo "<td align='center' class='sub-header'>".showsublinks(" ".THEME_BULLET." ", "white")."</td>\n";
   //echo "<td align='right' class='sub-header'>".showsubdate()."</td>\n";
   echo "<td class='sub-header-right'></td>\n";
   echo "</tr>\n</table>\n";
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Not quite possible if you remove from footer.

Because when your browser loads, it hits the maincore.php then it will load header.php and there it will start cache using ob_start() thee, then it will move to all files referenced, then load your page, then load panels, then load footer - and buffer out output and if reports have error, then it loads the error admin up.

Point of page render is at footer.php If you want header to load up error, I'm not sure.. probably need a mod on output handling.

On error admin, you do something like adding this around the error handler to inject back the link to header using JS.


$error_link = "<a href='".ADMIN."errors.php".$aidlink."'>".$locale['err_101']."</a>";

if (count($_errorHandler) > 0)) {
echo "<script type='text/javascript'>
var html = $error_link;
$('div#error-container').append(html).show();
echo "</script>\n";
}


Then on header.php you do a hidden container like this...


<body>....
echo "<div id='error-container' style='display:none;'></div>\n";


Probably would work, but I'm not sure. My logic is if the error is already parsed after finishing rendering, and when it happens footer pop up notice if error happens. When that happens, you immediately do a JS duplicate a link on top.

Another way is to go to utilize our output_handler like how add_to_head does its magic using global cache.

1. Duplicate add_to_head function, rename like add_to_error_box();

2. Then do an action in handle_output() function down. For add_to_head it's preg_replace("</head>"..."); you can do like preg_replace("<div id='error-box'></div>"...);

3. echo the error box on header. now, css style #error-box { display:none;}

4. trigger it on count($_errorHandler>0) { add_to_error_box("whatever you want to add here); }

The simplest method is like this..

During visiting your site, hit on the spacebar. It automatically scroll down to the most bottom. Then point your mouse to the error link. Hola!


Again, to my knowledge, fusion only start buffering output AFTER finishing loading footer.php. Before that it's all caches and is blank.

Hope this helps.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet