Custom 404 page problem...

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
[email protected]
Registered User
Posts: 149
Joined: Sat Jan 04, 2014 6:39 pm

Custom 404 page problem...

Post by [email protected] »

So I have been setting up the 404 page, and I am trying to upload a custom image to it... But whenever I put it there it does not show up right.

Heres the code I am using:
<img src="{T_THEME_PATH}/images/404pic1.jpg">

It just appears like a blue question mark...

Any chance you would know what wrong?

http://www.astronomertalk.com/404

Best,
JB
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Custom 404 page problem...

Post by Oyabun1 »

phpBB template variables are not parsed in pages that are external to phpBB.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
[email protected]
Registered User
Posts: 149
Joined: Sat Jan 04, 2014 6:39 pm

Re: Custom 404 page problem...

Post by [email protected] »

Oyabun1 wrote:phpBB template variables are not parsed in pages that are external to phpBB.
Ohh... Well ok, im pretty sure its an easy fix. is there a better section to post it.
Danielx64
Registered User
Posts: 1369
Joined: Wed Nov 04, 2009 5:51 am
Location: In a server room in Australia
Name: Daniel

Re: Custom 404 page problem...

Post by Danielx64 »

[email protected] wrote:
Oyabun1 wrote:phpBB template variables are not parsed in pages that are external to phpBB.
Ohh... Well ok, im pretty sure its an easy fix. is there a better section to post it.
Is this any good for you?

https://www.phpbb.com/customise/db/mod/ ... _messages/ It can be changed to fit your needs :)
Please note that I will not be porting any of my mods to phpBB 3.1. Sorry for the inconvenience this may cause.
Image
User avatar
Starskull
Registered User
Posts: 22
Joined: Tue Jan 14, 2014 6:50 am

Re: Custom 404 page problem...

Post by Starskull »

I think your best bet would be to do it this way. This is the way I did it and achieved a great custom 404 error page. my 404 page for reference.

First create the php file. Name this file 404.php

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    page_header('404 Error');

    $template->set_filenames(array(
        'body' => 404.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>
Save this file to the root of your phpbb installation.

Next you will make the actual html page.

Make a new page and name it 404.html

Code: Select all

    <!-- INCLUDE overall_header.html -->

    <h2>404 Error</h2>

    <div class="panel">
       <div class="inner"><span class="corners-top"><span></span></span>

       <div class="content">
          <p>
            <img src="yourstyle/theme/images/404pic1.jpg"> 
          </p>
       </div>

       <span class="corners-bottom"><span></span></span></div>
    </div>

    <!-- INCLUDE jumpbox.html -->
    <!-- INCLUDE overall_footer.html -->
Save and upload to yourstyle/template.

This should work. If the image code doesn't work use the direct path for it as in. http://yourdomain/styles/theme/images/404pic1.jpg

Hope this works for you.
[email protected]
Registered User
Posts: 149
Joined: Sat Jan 04, 2014 6:39 pm

Re: Custom 404 page problem...

Post by [email protected] »

Starskull wrote:I think your best bet would be to do it this way. This is the way I did it and achieved a great custom 404 error page. my 404 page for reference.

First create the php file. Name this file 404.php

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    page_header('404 Error');

    $template->set_filenames(array(
        'body' => 404.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>
Save this file to the root of your phpbb installation.

Next you will make the actual html page.

Make a new page and name it 404.html

Code: Select all

    <!-- INCLUDE overall_header.html -->

    <h2>404 Error</h2>

    <div class="panel">
       <div class="inner"><span class="corners-top"><span></span></span>

       <div class="content">
          <p>
            <img src="yourstyle/theme/images/404pic1.jpg"> 
          </p>
       </div>

       <span class="corners-bottom"><span></span></span></div>
    </div>

    <!-- INCLUDE jumpbox.html -->
    <!-- INCLUDE overall_footer.html -->
Save and upload to yourstyle/template.

This should work. If the image code doesn't work use the direct path for it as in. http://yourdomain/styles/theme/images/404pic1.jpg

Hope this works for you.
I just tried it, and it did not work :oops:

The image just wont load whatever I do...
Danielx64
Registered User
Posts: 1369
Joined: Wed Nov 04, 2009 5:51 am
Location: In a server room in Australia
Name: Daniel

Re: Custom 404 page problem...

Post by Danielx64 »

You may need to take out all the whitespace before the <?php and after the ?>
Please note that I will not be porting any of my mods to phpBB 3.1. Sorry for the inconvenience this may cause.
Image
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Custom 404 page problem...

Post by Lumpy Burgertushie »

you are trying to combine making a new phpbb page with using your hosting control panel to create a 404.shtml file.

in your 404.shtml file you are using the phpbb variables and that won't work because you are not using a phpbb php file at all.

you need to do what he said.

create your php file and rename your shtml file to html

then, you will need to go to your hosting control panel and point your server to your custom error page.


also you need to change this line:
<img src="SE_Gamer/theme/images/404pic1.jpg">

to

<img src="{T_THEME_PATH}/images/404pic1.jpg">

or,
if you want to use the shtml file you need to not use phpbb paths and varibles because they will not work.

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.

Return to “[3.0.x] Support Forum”