Davis Harrison Dion Posted March 8, 2021 Share Posted March 8, 2021 Hello, I'm drawing a blank and cannot seem to find the right answer to the question I think I'm asking, but: If I want to display the contents of a page on another page, how can I pass some arguments to the page I want to display? It's been a few months since I've touched this project. Thanks! Link to comment Share on other sites More sharing options...
Jan Romero Posted March 8, 2021 Share Posted March 8, 2021 If you use $myPage->render() you can use the options array: echo $myPage->render(['lol' => 'dongs']); /////// then on $myPage’s template ///////// echo $options['lol']; Or you could just add the property to the Page object: $myPage->set('lol', 'dongs'); echo $myPage->render(); /////// then on $myPage’s template ///////// echo $page->lol; 1 1 Link to comment Share on other sites More sharing options...
Davis Harrison Dion Posted March 8, 2021 Author Share Posted March 8, 2021 @Jan Romero Thanks! That should work. I think I incorrectly assumed after too quickly glancing at the api docs that render() is only for files and not for a selected page or pages. Link to comment Share on other sites More sharing options...
Jan Romero Posted March 8, 2021 Share Posted March 8, 2021 Yeah, the documentation is kind of buried: https://processwire.com/api/ref/page-render/render-page/. I don’t even know how to get there, really. The PageRender class doesn’t show up on the API frontpage at all… 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now