This feature lets you:
Security rules are respected for inserted web parts. To see inserted content, a reader must have viewing permissions for both:
Only administrators and members of the Developers group can create or edit HTML pages that include <script> tags.
To embed a web part in an HTML wiki page, open the page for editing and go to the HTML Source tab. (Do not try to preview using the Visual tab, because this will cause <p> tags to be placed around your script, breaking it.) Use the following syntax, substituting appropriate values for the substitution parameters in single quotes:
${labkey.webPart(partName='PartName', showFrame='true|false', namedParameters…)}
You can find the web part names to use as the 'partName' argument in the Web Part Inventory. These names also appear in the UI in the Select Web Part drop-down menu.
The Web Part Configuration Properties page covers the configuration properties that can be set for various types of web parts inserted into a web page using the syntax described above
See Examples: Embedded Web Parts. That page includes a link to the HTML source for its samples.
Wiki Example. To include a wiki page in another wiki page, use:
${labkey.webPart(partName='Wiki', showFrame='false', name='includeMe')}
where includeMe is the name of another wiki page in the same folder.
For a wiki page in a different container, use the webPartContainer property. To get the webPartContainer for the source container, see Web Part Configuration Properties.
${labkey.webPart(partName='Wiki', showFrame='false', webPartContainer='aa644cac-12e8-102a-a590-d104f9cdb538' name='includeMe')}
Search Example. The following snippet embeds a Search web part in a wiki page. Setting location='right' means that the narrow wiki part is used, so the web part will display in the right column of a page.
${labkey.webPart(partName='Search', showFrame='false', location='right',
includeSubFolders='false')}
Files Example. The following snippet embeds a Files web part in a wiki page.
<div id='fileDiv'/>
<script type="text/javascript">
LABKEY.requiresScript("fileBrowser.js");
LABKEY.requiresScript("FileContent.js");
var wikiWebPartRenderer = new LABKEY.WebPart({
partName: 'Files',
renderTo: 'fileDiv'
});
wikiWebPartRenderer.render();
</script>
Table of Contents Example.
${labkey.webPart(partName='Wiki Table of Contents', showFrame='false')}
You can also embed dependencies on other JavaScript or CSS files into your wiki using similar syntax.
${labkey.dependency(path='path here')}
For example, your wiki could include a line like the following:
${labkey.dependency(path='myFolder/myFile.js')}
${labkey.dependency(path='myFolder/stylesheet.css')}
See also Declare Dependencies.
AJAX Example. Use the client API to dynamically AJAX webparts into an HTML page:
<div id='tocDiv'/><br/>
<div id='searchDiv'/>
<script type="text/javascript">
var tocRenderer = new LABKEY.WebPart({
partName: 'Wiki TOC',
renderTo: 'tocDiv'
})
tocRenderer .render();
var tocRenderer = new LABKEY.WebPart({
partName: 'Search',
renderTo: 'searchDiv'
})
tocRenderer .render();
</script>