Reputation: 1301
So how can I pass a variable into a script that is not connected with symfony?
For example, I have variable $a
, which I render in template a.html.php
How can I use this $a
in some example.php
script?
More close: I wanna make image uploading with TinyMCE image manager; but each user should have their own directory (which corresponds to user id). So I should pass variable user_id to config.php
file of image manager.
So this directory depends on the user's session! How can I make different dirs to upload images for each user? Or can you advise me how to deal with this problem?
Maybe to use another text editor? Which one can I connect with symfony or to use different directories for different users?
Upvotes: 0
Views: 484
Reputation: 321
$formPath = 'nameBundle:name:name.html.twig';
$session = $controler->getRequest()->getSession();
$session->set('formPath', $formPath);
$session->set('neededVariables', $neededVariables);
return $controler->redirect($controler->generateUrl('show_result'));
I used this to handle data and read data function
public function showResultAction() {
$session = $this->getRequest()->getSession();
$formPath = $session->get('formPath');
$neededVariables = $session->get('neededVariables');
if ($formPath or $neededVariables)
return $this->render($formPath,$neededVariables); else
throw $this->createNotFoundException('The product does not exist');
}
Upvotes: 0
Reputation: 23265
You can store information in the session if you want to share it with other scripts. Make a var_dump($_SESSION)
in example.php to see what you already have.
Upvotes: 2