Embed plugin
Originally designed to embed content from the affiliate feeds component, this component can be used to include any content.
Example same site
{embed url=https://brokenlinkchecker.dev/documents/view-fix-404-errors tmpl=component}
Example remote site
This will require correct CORS headers
See this demo site for working examples
{embed url=https://demo.projecten.dev/datafeeds/3-kinderen tpl=list}
Risks
The plugin does not check nor validate the included content. Therefor, the plugin should only be used on websites with trusted authors.
Options
url (required)
This is the link to fetch. the response should only contain the actual html body of the component and only the required css to format that part.
default value: none
format
This option refers to the format defined in the view: components/<component>/src/View/<part>/<format>View.php. For datafeeds you can use the ajax
format. Other Joomla content would require html
.
default value: ajax
tmpl
This option refers to the file templates/<template>/<tmpl>.php. Most templates provide a component.php that returns a simplified version of your webpage. However some include unwanted css and javascript. In that case you will need to create your own tmpl:
?php
//templates/<template>/embed.php
//and use tmpl=embed
defined('_JEXEC') or die;
<jdoc:include type="component" />
For the datafeeds component, the ajax format ensures only the body is returned.
Default value: component
tpl
This option refers to components/<component>/tmpl/<part>/<format>_<tpl>.php
you can easily create your own layout by copying and existing <format>_<tpl>.php file.
Default value: default
ajax
- ajax=1, this will fetch the remote content as CORS
- ajax=0, the content will be fetched (and cached) by the plugin and included as html into the existing page.
Default value: 1
cache
Number of hours to cache content with ajax=0
default value: 8
num, sort, slogan, source
These options are appended to the URL. Their usage depends on the requested URL, mostly applicable to the datafeeds component.
Disabled with append=0.
Default values:
- num: 8
- sort: empty
- slogan: empty
- source: empty
append
Setting this value to zero will prevent any additional parameters added to the origian URL.
Default value: 1
useragent