Hi sorry for my horrible English. I need generate my module content only from template. Without JS heather etc. But i don't know how. Thanks for help.
Hi sorry for my horrible English. I need generate my module content only from template. Without JS heather etc. But i don't know how. Thanks for help.
Put some more effort in asking help; show what you need and show what you tried. In other words: give some more info, in horrible English.
THX the problem is solved by Ajax plugin from repository and any conditions in template. I need simply way for pure HTML output from my own module for ajax call.
You just need to echo your HTML out. You can get the HTML for any Contao template by using the parse() method.
If your template is stored in $this->Template all you need to do is:
This will output your module's HTML and nothing else.Code:$html = $this->Template->parse(); echo $html; exit();
For AJAX calls I normally use JSON, this makes it easy for your JavaScript to work with:
Code:$html = $this->Template->parse(); header('Content-type: application/json'); echo json_encode(array('html' => $html)); exit();
Bookmarks