Problems passing variables from controller to view

This should be an easy problem to resolve but I have been completely unable to pass a variable from my controller to my view. There was already a line of code that says:

$this->view->assign(compact('items', 'totalItems', 'locations'));

I originally tried adding a fourth variable to the list but I couldn't get that to work, so I eventually tried to just modify totalItems.

$totalItems = "82";

Now I would expect that I could get the value "82" in the corresponding view by using:

echo $this->totalItems;

Any ideas why this doesn't work? I've been working on this simple part of the project for two days :(