0

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?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

mm, it shows null result; mb cause session cant spread on file, required by js
did you use session_start() before?
oh my god, it works! dunno mb problem was in cache or smth else * and i even tryed before i wrote here O: unbelievable! thx alot! mb i have "curved hands") so thx thx! dunno why it didnt worked before! thx alot
0
$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');
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.