Jump to content

Passing an argument to a page - Best practice question


Recommended Posts

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

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;

 

  • Like 1
  • Thanks 1
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
 Share

  • Recently Browsing   0 members

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