Forums » Problems passing variables from controller to view

RSS feed for this topic

Info

  • Posted in Troubleshooting
  • Started 1 year ago by omekahacker
  • 1 post by 1 user
  1. 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 :(

    Thanks!

Reply

You must log in to post.