Jump to content

Render a whole page (footer include)


Recommended Posts

Hello Community,

I'm glad I discovered processwire and there are no words to tell you, how amazed I am by now.
My first post is a question, as just reading wasn't enough to find a solution this time - just to mention my great first impressions by the community. So hello all.
Enough love for now, I'm stuck at a problem which I thought would be easy to solve - sitting here for a day now.

Before going in detail, maybe I am missing something out in general:
Is it possible to render a complete, specific page inside a template? With all the markup rendered just like an include + the content? In case it is, here are my details:

I want to include my footer on every template via the '_main.php', as the footer does not change.
The footer is a custom template with 4 textfields and a page ('/footer/'), as I want to fill in the content from the backend - there are no files prepended or appended on it.

The footer-page renders fine, I can access '/footer/', but how can I render this page in the '_main.php'? So that I can change the footer in the backend (in all languages) and it prints on all pages?

I tried the following:


$footer = $pages->get('id=1036'); // also get('/footer/') just to make sure - knowing now all this returns just the id
$ftvar = $pages->get('id=1036');
$footer = $ftvar->render(); // This crashes my mysql
$footer = $ftvar->children->render(); // Just tried everything I could find
$footer = $ftvar->render('partial=true') // Throws error with and without '' - just found it, seems to be wrong as render does not take arguments
$footer = wireRenderFile("/footer/"); // Understanding it now


echo $footer;

And quite much other variations and possible solutions I can't remember anymore.
I learned a lot about what the API can get out of templates and specific fields - but my problem remains. I hope somebody can clear some things up for me as I just started with pw. 

Thanks for your time!

  • Like 1
Link to comment
Share on other sites

Welcome to the forum!

Just put this in your _main.php where the footer is:

$footer = $pages->get("1036");

And you have all the fields of your footer page. (you can omit the id= in your selector)

Then output your fields like that:

echo $footer->yourfieldname;

It's just one way of doing it.


  • Like 1
Link to comment
Share on other sites

Thanks @Klenkes, my mistake was the wrong architecture in mind. No need to include a whole rendered page or a special template. Markup of footer inside of '_main.php', filling it with the fields from the page via get(); - done.


Sorry for the extra long post and thanks!

  • Like 1
Link to comment
Share on other sites


just found it, seems to be wrong as render does not take arguments

Actually it does, but you need to send as an array:

$footer = $ftvar->render(array('partial' => 'true'));

Then you can get these using the $options variable:



Link to comment
Share on other sites

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...