You can pass any value into the layout using an array.

perch_layout('global.header', array(
    'title'=>'Welcome to my site!',

Having done so you can use these variables in the layout by passing the name to the perch_layout_var function. To output the “title” from the above perch_layout example we would use:

<title><?php perch_layout_var('title'); ?></title>

Values are automatically HTML-encoded so they’re safe for output. To return the value, or get it before it’s encoded (essential if the variable isn’t a string):

<?php $title = perch_layout_var('title', true); ?>