Jump to content

Recommended Posts

Posted

I'm not sure why I can't get render() to work. The include works so I know the path is correct. Any ideas?

//assign page
$page = $pages->get('name|domain_alias='.$host);

//redirect to 404 if we can't find a website that matches the host
if(empty($page)) {
    print '<h1>Page Not Found</h1>';  
}

//render child pages
foreach($page->children as $child) {
    include ($config->paths->templates.$page->theme[0]->name.'/'.$child->template.'.php');
    $child->render($config->paths->templates.$page->theme[0]->name.'/'.$child->template.'.php');
}
Posted

Do you think this is the problem?

//assign page
$page = $pages->get('name|domain_alias='.$host);

I need to be able to completely overwrite the old $page with one I've selected. 

Posted

You don't need to overwrite $page. And the 404 is usually: throw new Wire404Exception();

And how about echo $child->render(...); ?. PW never does echo something.

Posted

Thank you both for the help.

Soma, I was going to have to hunt this down, I couldn't remember how it was done. Thanks.

I tried render w/o the custom template path and still nothing. No error, just white screen. I don't even get an error when I remove the template.

I echoed $child->title and it's populated so I do have child pages.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...