Using the Content Plugin in Articles and Modules
Introduction
This article concentrates on using the Content plugin to show Downloads in Joomla! articles. The Plugin may also be used in Custom Modules and in Download Descriptions.
Note: If you have allowed Registered Users to create Content then be aware that in
Joomla! Global Configuration - Filtering
that the default for Registered is 'No HTML'.
You need to set to say 'Default Blacklist'.
Joomla! Global Configuration - Filtering
that the default for Registered is 'No HTML'.
You need to set to say 'Default Blacklist'.
Select Download using Content Button
In the following the actual code needed in an article or module to referencence a Download looks like the following
where the value 25 is the id of the required Download.
This means finding the id value of the Download which can be tedious in the frontend.

This means finding the id value of the Download which can be tedious in the frontend.
Remembering later what is say Download 48 in
can be annoying. But note you can also write
where TestUpload-en is a reminder of the name. This works because the Content plugin ignores text following the file ID so it is not shown.


The simplest way to add a Download is to use the jDownloads Content Button Plugin.
So the first step is to go to Extensions - Plugins and make sure that both the Content Plugin itself and the Content Button plugin are both active as illustrated opposite.
So the first step is to go to Extensions - Plugins and make sure that both the Content Plugin itself and the Content Button plugin are both active as illustrated opposite.

After activating the plugins then a button like
will be available on the Edit screen. The position of the Download Button depends on which editor you are using, sometimes it is in the tool bar and others it is often at the foot of the edit page.
After clicking on the button then a popup screen like below will appear. You can then search or scroll for the required Download. Clicking on its name will then insert the correct Content Plugin code in the article or the Module. You can also use the Content Plugin in the Description part of a Download.

After clicking on the button then a popup screen like below will appear. You can then search or scroll for the required Download. Clicking on its name will then insert the correct Content Plugin code in the article or the Module. You can also use the Content Plugin in the Description part of a Download.

View in Articles, Modules and Descriptions
Use <div> not <p>
If you are using a basic editor such as Code Mirror or similar then the Content Plugin code would appear as below, where in this example the 25 is the id of the Download.

Using a conventional WYSIWYG type editor such as JCE the entry in the article would look like the image below.
Again the Download and its surrounding text is again in a <div> ... </div> block.

Note that the JCE editor may be set to show the type of 'block' element.
Again the Download and its surrounding text is again in a <div> ... </div> block.

Note that the JCE editor may be set to show the type of 'block' element.
So, as might be expected, the result appears as a single line in the Front End.


Now let us see what happens if a Paragraph block <p> ... </p> is used instead of a Div block <div>...</div>.
The direct code as entered is shown below.

The view in the JCE editor is as shown below.

But in this case there is a line break immediately before the Download link!

See the Appendix below about changing the 'mode' of typical WYSIWYG editors such as JCE and Ark from Paragraph to Div dynamically.
Use In Custom Modules
Adding a Download link to a custom module is the mostly the same as adding into an article.
That is in the Module tab your default editor will show any 'buttons' such as the
button to enable adding the relevant code as describe above.
That is in the Module tab your default editor will show any 'buttons' such as the

But there is one more action required!
Select the Options tab, then ensure that the 'Prepare Content' field is set to Yes as indicated opposite.

Layout selection
The default layout for use in content is set in the jDownload Options - Plugin Tab.
A more flexible solution is to select the required layout in the content itself by using the form:
For example,
. This must of course appear in the article before the first actual Download that is to use the layout.
A more flexible solution is to select the required layout in the content itself by using the form:
jd_file onlinelayout=='layout name'
For example,

Any Download layout may be used. In these notes we use the simplest layout called 'Files link only' which comes as standard with jDownloads.
There are two other variations of this layout. These are available either by downloading from Extra jD 3.9 Download Layouts (opens in a new window/tab) and using the Layouts
button or by simply editing the Files link version as noted in the Edit layout Appendix below.
There are two other variations of this layout. These are available either by downloading from Extra jD 3.9 Download Layouts (opens in a new window/tab) and using the Layouts

- Files link only -----------------
This is a standard default Downloads layout which comes with jDownloads.
- Files link and icon --------------
Never shows the featured star.
- Files icon link and featured ---
Only shows feature star if Download is featured.
Some Examples
Individual Downloads
It maybe that the Downloads are to be listed with some text as shown opposite.
Layout "Files link and icon" is used in this example.

The direct code is shown opposite.

It is also possible to show several Downloads as an unordered list.
Here the Downloads are contained in a <ul> ...</ul> rather than a <div> sequence.
It could of course be an Ordered list by using <ol> ... </ol>.e
Here the Downloads are contained in a <ul> ...</ul> rather than a <div> sequence.
It could of course be an Ordered list by using <ol> ... </ol>.e

The direct entry or code view would be:

From Categories
As well as inserting individual Download links there are also Content Plugin calls to list Downloads from Categories
- Show Downloads from a single or several Categories: For example
will list upto 12 Downloads from those categories with IDs 15, 3, 41 and 6.
- Listing latest, top and last updated from any category:
lists the 6 most recently updated Downloads selected from the categories with IDs 17, 3 and 15.
- Listing latest, top and last updated from multiple categories:
lists the 5 most downloaded Downloads from the categories with IDs 12,13 and 3.
This example shows a listing of all the Downloads in a specific category.
Again the layout "Files icon link and featured" is used.
The code used is simply


And now examples of Latest, Hottest and Updated.
Only the top 3 in each case are shown in this example.
Layout "Files icon link and featured" was used.
The code is as shown below.


With a little more effort the sequential listing could be arranged in columns as illustrated.
In this case the direct code would be as below.


In this case the direct code would be as below.


Some Technical Details
When the Plugin code is generated from the short code { ... } then jDownloads adds specific CSS class names to the plugin's enclosing <div> dependent upon the actual form of the plugin.
For example with a file short code such as
then the plugin code itself starts with

For say a Hottest short code
the plugin code starts with

This then allows each type of Content plugin to have its own styling. For instance in the three column example above each column could have had its own background colour.
For example with a file short code such as


For say a Hottest short code


This then allows each type of Content plugin to have its own styling. For instance in the three column example above each column could have had its own background colour.
Appendix 1 - Editing Layout
The standard 'Files Link Only' layout is very simple. It is straightforward to edit the existing layout to create the other two layouts.
The first step is in the backend go to the jDowndoads Control Panel and select Layouts. Next select the Downloads layouts and click on 'Files link only'. This shows the line
Now click on the
button which will create a new layout called
.
So edit the title to become
.
Edit the layout code layout by adding where indicated by the yellow background to give

Next click on
and you now have the additional layout.
Whilst the details of the layout are still on screen click on
.
This will create a new layout called
so edit the title to become
.
The next step is to add the code
to give

where the code has been inserted as idicated by the yellow background.
Finally click on the
.
The first step is in the backend go to the jDowndoads Control Panel and select Layouts. Next select the Downloads layouts and click on 'Files link only'. This shows the line

Now click on the


So edit the title to become

Edit the layout code layout by adding where indicated by the yellow background to give

Next click on

Whilst the details of the layout are still on screen click on

This will create a new layout called


The next step is to add the code


where the code has been inserted as idicated by the yellow background.
Finally click on the

Appendix 2 - Selecting <div> mode
The 'default' mode of most WYSIWYG editors such as JCE and Ark is the Paragraph mode. It is very sraight forward to change the mode to <div>.
JCE Editor
For the JCE editor the 'editing' controls typically appear as opposite.

A simple Pull Down selection offers several 'modes'.
In this case select Div.
Obviously one can switch back and forth between the modes.

An advantage of the JCE editor is that it may be set to show the 'mode' of each block as indicated in the second picture opposite.
In most instances I use the Div mode all the time.


Ark Editor
The default setup for Ark is shown opposite.
|
![]() |
For Ark select Normal (DIV). This then uses <div> ... </div> blocks. | ![]() |
Colin Mercer February 2019, updated July 2020
Tags: index