A
A
Andrew Sky2016-02-19 18:32:51
PHP
Andrew Sky, 2016-02-19 18:32:51

How to pass the value of the variable to the component that is higher?

Problem following: There is a component and in it property. This property must be passed from the component to the page, and on the page, this variable should be used in another component. The big problem is that the component that should receive the variable is higher than the component that should give it back. Global variables won't help here. Tried delayed functions. Either I used them incorrectly, or they really only draw the result.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew Sky, 2016-02-20
@Sky161

Found the solution myself. The solution is the following:

  1. arrange the components on the page so that the component that passes the variable is higher in the code
  2. Further in the template of the second component (which received the parameter), we use our deferred functions. I used:
    <?$this->SetViewTarget('subitem');?>
      <pre>
        <?print_r($arResult);?>
      </pre>
    <?$this->EndViewTarget();?>

  3. Next, we can use the <?$APPLICATION->ShowViewContent('subitem');?> function above both of our components

N
Night, 2016-02-19
@maxtm

A muddled question. Be specific with code examples

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question