1

I have a problem recovering a variable in a view.

I followed this tutorial:

Once I have the other view, I can not send a variable so that I can get it back in the view.

Controller.php

      public function action_like($token = false, $bID = false)
{
    if ($this->bID != $bID) {
        return false;
    }
    if (Core::make('token')->validate('like_page', $token)) {
        $page = Page::getCurrentPage();
        $u = new User();
        $this->markLike($page->getCollectionID(), $page->getCollectionTypeID(), $u->getUserID());
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
            $b = $this->getBlockObject();

            //Normaly we set a variable for get in the view 
            // $this->set('test', 'test');

            $bv = new BlockView($b);
            $bv->render('view/view');            
        } else {
            Redirect::page($page)->send();
        }
    }
    exit;
}

view/view.php

<?php echo $test; ?>
<p> Title  <p/>

thanks for answers

toesslab
  • 5,092
  • 8
  • 43
  • 62

1 Answers1

0

Sessions provide a way to store information across multiple requests/pages.

You may use :

//...
$_SESSION["test"] = "test";
//...
Foued MOUSSI
  • 4,643
  • 3
  • 19
  • 39