This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

g39415
g39415

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?

g39415
g39415

This worked:

$theme = Theme::getActiveTheme(); $controller = new \Cms\Classes\Controller($theme); $html = $controller->renderContent("test_content.htm", ['foo' => 'bar']);

semasping7401
semasping7401

Thanks, Very helpful if need render some partial - you can use

$controller->renderPartial("test_content.htm", ['foo' => 'bar']);

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.