Many people have asked, "How can I embed a portlet in web content". It's actually quite simple, once you know how. So I'll walk you through it.
It;s done via a runtime-portlet tag. The actual syntax looks like this:
<div id="embedded-welcome-portlet">
<runtime-portlet name="47" instance="4433" queryString=""/>
</div>
Then the rendered web content will look like this.
But what if you want to use your own portlet? No problem, just use the name it is given by Liferay. In this case we'll use the Web Form portlet since it's not a Liferay built in portlet.
And now the web content looks like...
If the embedded portlet has a configuration option, you can configure it like any portlet to have different values on every page. You can also use the portlet's own Look and Feel to remove the borders or set a custom title. The WebForm portlet does have it's own configuration options (Hello World does not) Unfortunately at this time, you cannot use it's own configuration Look and Feel to style it, as the Web Content that contains it, overrides it's styling.
Since one of the parameters is an instance-id, you can have multiple embedded instances of the same portlet on the page as below.
And there you are! A portlet embedded in web content.
If you're interested in more leave a comment. Thanks for reading.


