TinyPortal

Development => Support => Topic started by: gffb on May 20, 2007, 04:40:26 PM

Title: 404 error page use default theme
Post by: gffb on May 20, 2007, 04:40:26 PM
Hi all,

I have a cusrom 404 error page called error.php and would like it to use the default TP-SMF 1.1.2 theme when a 404 error arises, here is the error.php code, what do I need to do to mae it look like the rest of the site?
<?php
 
if (isset($_GET['Error']))
 {
   
$Error = $_GET['Error'];
 }
 else
 {
   
header('Location: index.php');
 }
 
$Text = '';
 
$Do_What = '';
 switch(
$Error)
 {
   case
404:
     
$Text    = 'A <span class="Error" style="font-style:italic;">404</span> error has occured. This means the file/folder you requested does not exist.';
     
$Do_What = 'Please try typing the file/folder name again and or, check the file still exists.';
      break;
 }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css">
      <!--
        body
        {
          background-color: #202831;
        }
        .Error
         {
          color: #FF0000;
          font-weight: bold;
        }
      //-->
    </style>
    <title>ERROR!</title>
  </head>
  <body>
    <font size="1">
    <?php
     
echo '<span class="Error">An Error has occured.</span><br /><br />';
     echo
'<span class="Error">Error:</span> ' . $Text . '<br /><br />';
     echo
'<span class="Error">What can I do:</span> ' . $Do_What . '<br />';
   
?>
    </font>
  </body>
</html>
Title: Re: 404 error page use default theme
Post by: Zetan on May 20, 2007, 04:56:36 PM
Have a looky at this Topic.. we had a discussion about 404 error pages.. You might find some bits useful  :)
http://www.tinyportal.net/index.php?topic=14951.0
Title: Re: 404 error page use default theme
Post by: gffb on May 20, 2007, 04:58:07 PM
Thanks Zetan that was the first place I started and yes it help but still did not find any information regarding to having a 404 page look like your forum default theme.
Title: Re: 404 error page use default theme
Post by: Zetan on May 20, 2007, 05:03:36 PM
okay... well, there would be a lot of code... or a way to have the error page sit in an Article.
Not sure the best way to go about it.. iframe maybe? or maybe one of the coders might have an idea.
Title: Re: 404 error page use default theme
Post by: gffb on May 20, 2007, 05:35:17 PM
yeah have it as an article might be a way of doing it will just have to edit the .htaccess file to point to the article that would do it I think??
Title: Re: 404 error page use default theme
Post by: Zetan on May 20, 2007, 05:40:26 PM
I had thought about keeping it within the site... My only thoughts are if the site is broken and one of the error pages relies on the site.. It might not work. You might find that you still get an external error page... It's one of the reasons I just kept it to a page on the server.
Title: Re: 404 error page use default theme
Post by: gffb on May 20, 2007, 05:53:34 PM
Yeah that is a good point might just try and emulater the look of the site as in background colour, text size style and colour and see what that looks like, is there a file where I can get thebasic default theme setting as stated above from?