This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I am loading the html content for some modals using AJAX. For small html blocks I was handling this within my plugin controller. Now I have a very large html block that I want to load and it's more clear and readable if put in a content block. However I can't find a way from a controller to load the html e.g the PHP equivalent for {% content 'welcome.htm' name='John' %} Is this possible?
This worked:
$theme = Theme::getActiveTheme(); $controller = new \Cms\Classes\Controller($theme); $html = $controller->renderContent("test_content.htm", ['foo' => 'bar']);
Thanks, Very helpful if need render some partial - you can use
$controller->renderPartial("test_content.htm", ['foo' => 'bar']);
1-3 of 3