Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set404 loading blank page #23

Open
jhenriksen opened this issue Sep 23, 2015 · 4 comments
Open

set404 loading blank page #23

jhenriksen opened this issue Sep 23, 2015 · 4 comments

Comments

@jhenriksen
Copy link

I'm having an issue trying to call set404. It's just loading a blank page rather than the 404 page set in the global template preferences. Any ideas? Here's what I'm working with:

$config['resource_router'] = array(
    //Redirect old lab URLs to new lab templates
    'research/labs/:any/:all' => function($router, $wildcard_1, $wildcard_2) {
        $lab_channel_ids = array(
            //'old_lab_url_slug' => channel_id
            'lab1' => 16,
            'lab2' => 17
        );

        //Look for supported lab in first segment
        if( array_key_exists($wildcard_1->value, $lab_channel_ids) ) {
            $where = array('channel_id' => $lab_channel_ids[$wildcard_1->value]);
            $url_slug = $wildcard_1->value;

            //Look to see if the second segment is a valid url_title in the correct channel
            if( $wildcard_2->isValidUrlTitle($where) ) {
                $url_slug .= '/'.$wildcard_2->value;
            }

            $router->redirect('research-labs/'.$url_slug);
        } else {
            $router->set404();
        }
    }
);
@rsanchez
Copy link
Owner

What version of EE? What if you make a route that only does set404, does that work?

@jhenriksen
Copy link
Author

EE v2.10.1

I added the following and I get the same blank page:

    'test/:any' => function($router) {
        $router->set404();
    }

@rsanchez
Copy link
Owner

Just tested on EE 2.10.1 and it works as expected.

There might be a plugin in your 404 template causing a WSOD. Try setting $debug = 1 in your index.php and see if you can spot any PHP errors.

@jhenriksen
Copy link
Author

Thanks for loading that into 2.10.1 and giving it a try.

I set $debug = 1 and I don't see any errors. The 404 page also works in EE templates when I call {redirect="404"}

I replaced the content in my 404 template with just plain text and gave it another try, but got the same result.

I tried setting Display Output Profiler and Display Template Debugging to Yes to see if that gave any hints:

(0.000016 / 1.29MB) - Begin Template Processing -
(0.000048 / 1.29MB) URI: research/labs/123xyz
(0.000066 / 1.29MB) Path.php Template: ./.
(0.000088 / 1.29MB) Retrieving Template
(0.000116 / 1.29MB) Retrieving Template from Database: ./.
(0.017578 / 1.35MB) Template Not Found
(0.017615 / 1.34MB) Template Type:
(0.017647 / 1.35MB) Parsing Site Variables

That looks really similar to Issue #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants