Say you have a search box at the top of your page, but you want to make it contextual to the area that you're in. For example, on the contacts view, you want the search button to say "Search Contacts". Your search button is on the layouts/main.php page. Here's how:
add a variable, such as "searchButtonArea"
in layouts/main.php, add that value to the search buttons, such as <?="Search $this->searchButtonArea"?>
then, in your contact views, set $this->searchButtonArea = "Contacts";
Or, add a property to the ContactsController, $searchButtonArea='Contacts';