I want to find out a more efficient way of going about this function:
<?php
function zipError($title, $desc) {
echo '<style type="text/css">';
echo 'body { margin:0;font-family:Arial, sans-serif;font-size:13px;background:#DDD;color:#1A1A1A; }';
echo 'h1 { color:#FFF;font-family:Arial;font-weight:bold;text-align:center; }';
echo 'h2 { color:#1C1C1C;font-family:Arial;font-weight:bold;text-align:center;padding-bottom:4px;border-bottom:1px solid #AAA; }';
echo '#error#head { background:#1C1C1C;padding:10px;;border-bottom:5px solid #FFF; }';
echo '#error#content { border:1px solid #AAA;background:#FFF;padding:20px;width:780px;margin:30px auto; }';
echo 'p { text-align:center;padding:10px;color:#1A1A1A;font-family:verdana; }';
echo '</style>';
echo '<title>' . $title . '</title>';
echo '<div id="error head"><h1>An error has occurred.</h1></div>';
echo '<div id="error content"><h2>'.$title.'</h2><p>'.$desc.'</p></div>';
}
This code is used to throw an error. For example:
die(zipError('Session Not Found', 'Your session has not been found! Please re-login now!'));
Although this gets the job done, I'm trying to learn, so therefore I want to make this function more efficient, and not hard coded. Any ideas?