etnastyles Posted September 8, 2008 Share Posted September 8, 2008 Is it possible to style an exit() or die() message? i was trying: p.error { font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; color:red; } exit("<p class=\"error\">".ERROR_VIDEO_LINK."</p>"); and this didnt work btw and then i tried using a div wrapped around the exit message and this isnt working either. I feel it is very boring to just be presented with black text.. I was thinking of redirecting the user to another page but then i would have to mantain this page too. Has anyone seen a solution to this style error??? regards ??? Quote Link to comment https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/ Share on other sites More sharing options...
JonnoTheDev Posted September 8, 2008 Share Posted September 8, 2008 Dont think this is possible. The exit() and die() functions are not designed for this. You can either print your html to the screen then exit or die, or implement a custom error handler that displays an error page. Quote Link to comment https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/#findComment-636498 Share on other sites More sharing options...
etnastyles Posted September 8, 2008 Author Share Posted September 8, 2008 you cant write the html styled first as all the styles are dropped when you use the exit or die function. i.e. p.error { font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; color:red; } echo "<p class=\"error\">".ERROR_VIDEO_LINK."</p>"; exit(); I had a look at custom error handler @ http://uk2.php.net/set-error-handler not really my cup of tea thanks for the info however i think i will have to just live with it or do a change of location once the script has exit() or die(). boooooooooo Quote Link to comment https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/#findComment-636509 Share on other sites More sharing options...
JonnoTheDev Posted September 8, 2008 Share Posted September 8, 2008 Place the CSS inside the P tag as a style attribute and not in the stylesheet Quote Link to comment https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/#findComment-636524 Share on other sites More sharing options...
haku Posted September 8, 2008 Share Posted September 8, 2008 The CSS will only kick in if the error happens after the CSS has been loaded - IE the die function comes after the link declarations in the head. As a side note though, die declarations should not be used on a live site with database queries, as it is a security risk. It gives hackers information as to what is going on behind the scene, meaning they have more ammo to attack your site with. Quote Link to comment https://forums.phpfreaks.com/topic/123251-style-an-exit-or-die/#findComment-636749 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.