How do I get the HTML from agile toolkit virtual page

90 views Asked by At

I'm using agile toolkit 4.3.2. I have a virtual page that contains a form.

I created a button:

$this->button = $this->addButton('')
            ->setAttr('title', 'Show Virtual Page');

And I binded the virtual page to this button:

$vp = $this->button->add('VirtualPage', $size)->bindEvent('Show Virtual Page', 'click');

What I want is to get the HTML of the virtual page without pressing a Button. How can I do that? I want to have the HTML in a variable to pass it to another location in order to render it later.

Please tell me how can I get the HTML of a virtual page without pressing a button. I want to have the content after the page is loaded. How can I do that?

1

There are 1 answers

4
DarkSide On

This is example how you can add button in page and when you click on that button, then dialog will open in which you'll see virtual page with any content you want:

$b = $page->add('Button')->set('Open popup');
$vp = $b->add('VirtualPage')
    ->bindEvent('My Cool Title','click')
    ->set(function($page){
        $page->add('LoremIpsum');
    });

I am not sure why you would want to get HTML of that VirtualPage. You have to avoid to work directly with html code anyway :)

Anyway in this case VirtualPage will not be rendered at all while button is not clicked.

In some cases you can try to use $vp->getPage()->getHTML();