Перейти к содержанию
  • Меняем сообщение об ошибке в БД MySQL


    IAF

    Для того, чтобы изменить страницу ошибки нужно:

    • FTP-клиент
    • Редактор текста
    • Знание HTML/PHP
    • И чуть-чуть времени

    Файл с текстом ошибки лежит по пути: <ваш_форум>/cache/skin_cache/system/ipsDriverError.php его и нужно редактировать.
    Внутри PHP-файла находится HTML-разметка страницы с ошибкой. Главное редактировать то, что лежит внутри тега <html>...</html>, тогда не промахнётесь.
    На всякий случай - стандартный текст этого файла: 

     

     

    <?php
     
    class ipsDriverError extends systemTemplate
    {
    public function getTemplate( $name = '', $errorMessage = '', $errorBlock = '', $settings = array() )
    {
    return <<<EOF
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "__www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xml:lang="en" lang="en" xmlns="__www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="Fri, 01 January 1999 01:00:00 GMT" />
    <title>{$name} Driver Error</title>
    <style type='text/css'>
    body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; } 
    table { border-collapse:collapse; border-spacing:0; }
    fieldset,img { border:0; }
    address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
    ol,ul { list-style:none; }
    caption,th { text-align:left; }
    h1,h2,h3,h4,h5,h6 { font-size:100%; font-weight:normal; }
    q:before,q:after { content:''; }
    abbr,acronym { border:0; }
    hr { display: none; }
    address{ display: inline; }
    body {
    font-family: arial, tahoma, sans-serif;
    font-size: 0.8em;
    width: 100%;
    }
     
    h1 {
    font-family: arial, tahoma, "times new roman", serif;
    font-size: 1.9em;
    color: #fff;
    }
    h2 {
    font-size: 1.6em;
    font-weight: normal;
    margin: 0 0 8px 0;
    clear: both;
    }
    a {
    color: #3e70a8;
    }
     
    a:hover {
    color: #3d8ce4;
    }
     
    a.cancel {
    color: #ad2930;
    }
    #branding {
    background: #484848;
    padding: 8px;
    }
     
    #content {
    clear: both;
    overflow: hidden;
    padding: 20px 15px 0px 15px;
    }
     
    * #content {
    height: 1%;
    }
     
    .message {
    border-width: 1px;
    border-style: solid;
    border-color: #d7d7d7;
    background-color: #f5f5f5;
    padding: 7px 7px 7px 30px;
    margin: 0 0 10px 0;
    clear: both;
    }
     
    .message.error {
    background-color: #f3dddd;
    border-color: #deb7b7;
    color: #281b1b;
    font-size: 1.3em;
    font-weight: bold;
    }
     
    .message.unspecific {
    background-color: #f3f3f3;
    border-color: #d4d4d4;
    color: #515151;
    }
    .footer {
    text-align: center;
    font-size: 1.5em;
    }
     
    .database-error {
    padding: 4px 0px 10px 80px;
    margin: 10px 0px 10px 0px;
    }
     
    textarea {
    width: 700px;
    height: 250px;
    }
     
    ul {
    list-style: disc outside;
    list-style-type: circle;
    margin: 12px 0 12px 40px; 
    }
     
    ol {
    margin: 12px 0 12px 40px !important;
    list-style-type: decimal !important;
    }
     
    </style>
    </head>
    <body id='ipboard_body'>
    <div id='header'>
    <div id='branding'>
    <h1>{$name} Driver Error</h1>
    </div>
    </div>
    <div id='content'>
    <div class='message error'>
    There appears to be an error with the database.
    {$errorBlock}
    </div>
     
    <p class='message unspecific'>
    If you are seeing this page, it means there was a problem communicating with our database.  Sometimes this error is temporary and will go away when you refresh the page.  Sometimes the error will need to be fixed by an administrator before the site will become accessible again.
    <br /><br />
    You can try to refresh the page by clicking <a href="#" onclick="window.location=window.location; return false;">here</a>
    </p>
    <p class='message unspecific footer'>
    &larr; <a href='{$settings['board_url']}' title='Go to home page'>Return to the index</a>
    </p>
    </div>
    </body>
    </html>
     
    EOF;
     
    }
    }
     

     

     
    Вот пример моего файла:

    Spoiler 
     

     

    <?php
    
    class ipsDriverError extends systemTemplate
    {
    	public function getTemplate( $name = '', $errorMessage = '', $errorBlock = '', $settings = array() )
    	{
    $date = date("d.m.Y H:i");
    		return <<<EOF
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "__www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xml:lang="en" lang="en" xmlns="__www.w3.org/1999/xhtml">
    	<head>
    		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
    		<meta http-equiv="Pragma" content="no-cache" />
    		<meta http-equiv="Cache-Control" content="no-cache" />
    		<meta http-equiv="Expires" content="Fri, 01 January 1999 01:00:00 GMT" />
    		<title>{$name} Ошибка БД</title>
    		<style type='text/css'>
    			body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; } 
    			table {	border-collapse:collapse; border-spacing:0; }
    			fieldset,img { border:0; }
    			address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
    			ol,ul { list-style:none; }
    			caption,th { text-align:left; }
    			h1,h2,h3,h4,h5,h6 { font-size:100%;	font-weight:normal; }
    			q:before,q:after { content:''; }
    			abbr,acronym { border:0; }
    			hr { display: none; }
    			address{ display: inline; }
    			body {
    				font-family: arial, tahoma, sans-serif;
    				font-size: 0.8em;
    				width: 100%;
    			}
    			
    			h1 {
    				font-family: arial, tahoma, "times new roman", serif;
    				font-size: 1.9em;
    				color: #fff;
    			}
    			h2 {
    				font-size: 1.6em;
    				font-weight: normal;
    				margin: 0 0 8px 0;
    				clear: both;
    			}
    			a {
    				color: #3e70a8;
    			}
    			
    				a:hover {
    					color: #3d8ce4;
    				}
    				
    				a.cancel {
    					color: #ad2930;
    				}
    			#branding {
    				background: #484848;
    				padding: 8px;
    			}
    			
    			#content {
    				clear: both;
    				overflow: hidden;
    				padding: 20px 15px 0px 15px;
    			}
    			
    			* #content {
    				height: 1%;
    			}
    			
    			.message {
    				border-width: 1px;
    				border-style: solid;
    				border-color: #d7d7d7;
    				background-color: #f5f5f5;
    				padding: 7px 7px 7px 30px;
    				margin: 0 0 10px 0;
    				clear: both;
    			}
    			
    				.message.error {
    					background-color: #f3dddd;
    					border-color: #deb7b7;
    					color: #281b1b;
    					font-size: 1.3em;
    					font-weight: bold;
    				}
    				
    				.message.unspecific {
    					background-color: #f3f3f3;
    					border-color: #d4d4d4;
    					color: #515151;
    				}
    			.footer {
    				text-align: center;
    				font-size: 1.5em;
    			}
    			
    			.database-error {
    				padding: 4px 0px 10px 80px;
    				margin: 10px 0px 10px 0px;
    			}
    			
    			textarea {
    				width: 700px;
    				height: 250px;
    			}
    
    			ul {
    				list-style: disc outside;
    				list-style-type: circle;
    				margin: 12px 0 12px 40px; 
    			}
    
    			ol {
    				margin: 12px 0 12px 40px !important;
    				list-style-type: decimal !important;
    			}
    			
    		</style>
    	</head>
    	<body id='ipboard_body'>
    		<div id='header'>
    			<div id='branding'>
    				<h1>{$name} Ошибка Базы Данных</h1>
    			</div>
    		</div>
    		<div id='content'>
    			<div class='message error'>
    				Произошла ошибка с Базой Данных MySQL :(
    				{$errorBlock}
    			</div>
    			
    			<p class='message unspecific'>
    				Если вы видите эту страницу, то это значит, что произошла ошибка в Базе Данных форума. Ошибка может быть как временной, так и постоянной. Пожалуйста, сообщите Администратору об ошибке, указав ссылку по которой вы перешли и дату.<br />
    Дата ошибки: <b>{$date}</b>
    				<br /><br />
    				Вы можете попробовать <a href="#" onclick="window.location=window.location; return false;">перезагрузить страницу</a>
    			</p>
    			<p class='message unspecific footer'>
    				&larr; <a href='{$settings['board_url']}' title='На главную'>На главную</a>
    			</p>
    		</div>
    	</body>
    </html>
    
    EOF;
    
    	}
    }

     

    Кстати, можно отметить, что я добавил вывод даты ошибки в теле страницы.

    Для этого нужно после

    public function getTemplate( $name = '', $errorMessage = '', $errorBlock = '', $settings = array() )
    	{

    вставить

    $date = date("d.m.Y H:i");

    И в теле страницы (<html>...</html>) в месте для вывода даты вставить {$date}.


    Обратная связь

    Рекомендуемые комментарии

    Комментариев нет



    Присоединяйтесь к обсуждению

    Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.
    Примечание: Ваш пост будет проверен модератором, прежде чем станет видимым.

    Гость
    Добавить комментарий...

    ×   Вставлено с форматированием.   Вставить как обычный текст

      Разрешено использовать не более 75 эмодзи.

    ×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

    ×   Ваш предыдущий контент был восстановлен.   Очистить редактор

    ×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.


×
×
  • Создать...