To render the entire text from the article you can use the [text]
tag.
You can also decide to only show the [introtext]
(the text part above the readmore bar, if present) or the [fulltext]
(the text part below the readmore bar, if present).
Additionally, with any text data tag - like [text]
, [introtext]
, [fulltext]
, [title]
, [metakey]
, [metadesc]
, and even custom fields such as text
, textarea
and editor
, you have the following features at your disposal:
Limiting
You can limit any text data tag to only show a certain amount of characters. HTML tags and images are not counted, only the text itself.
Limit by characters
For example, to show the first 100 characters of the entire text, simply use:
[text characters="100"]
Limit by letters J4
You can also limit based on only the letters, without counting spaces:
[text letters="50"]
Limit by words
To limit the text to a number of words, you can do:
[text words="20"]
Limit by paragraphs
You can limit the text to a number of paragraphs. This will break off the text after the second </p>
tag it finds in the html code:
[text paragraphs="2"]
Add Ellipsis
If you decide to limit the text to a certain amount of characters/words, you can append ...
dots to the end of the text.
You can do so with an add-ellipsis
attribute, giving it a value of true
or false
depending on your preference:
[text characters="100" add-ellipsis="true"]
Stripping
Strip HTML tags
If you want to remove the HTML tags from the text, you can do:
[text html="false"]
[text characters="100" html="false"]
Strip image tags
You might want to keep the HTML tags and styling of the content, but remove the images. You can do that with:
[text images="false"]
Add slashes / escape
If you want to add slashes to single and double quotes, you can do:
[text escape="true"]
To only escape single quotes:
[text escape="single"]
And to only escape double quotes:
[text escape="double"]
HTML entities
If you want to add convert special characters to html entities, you can do:
[text htmlentities="true"]
Convert Case J4
For any text data tag, you can convert the casing and capitalization of the text in various ways, by using the convert-case="..."
attribute:
Syntax | Description |
---|---|
[text convert-case="camel"] | thisIsAString |
[text convert-case="dash"] | this-is-a-string |
[text convert-case="dot"] | this.is.a.string |
[text convert-case="lower"] | this is a string |
[text convert-case="lower-first"] | this is a String |
[text convert-case="pascal"] | ThisIsAString |
[text convert-case="title"] | This Is A String |
[text convert-case="upper"] | THIS IS A STRING |
[text convert-case="upper-first"] | This is a string |
[text convert-case="underscore"] | this_is_a_string |
Offset Headings
When including the text of multiple articles inside another article, you might want to shift the heading tags of the placed articles to a lower level.
You can offset the level of the headings in text data tags by using an offset-headings="..."
attribute. For instance, to convert H1 to H3, H2 to H4 and so on, set the attribute to 2:
[text offset-headings="2"]
Headings will be a minimum of 1 and a maximum of 6. So if you have headings going up to H6, then with offset_headings="1"
both H5 and H6 will become H6.
Search & Replace J4
You can even search and replace inside any text data tag, by using the replace="..."
attribute.
For example, this is the syntax to replace cats
with dogs
inside the [text]
data tag:
[text replace="cats=>dogs"]
If you need to do multiple replacements, you can separate them with a comma:
[text replace="cats=>dogs,kittens=>puppies"]
This can come especially useful to make custom replacements when using the External Database feature.
Part of the Text by element ID J4
You can also decide to extract only part of the text from an article by specifying the id
of the HTML element that you want to output.
For example:
[text id="my-div"]
This will only output the div
element with id "my-div" from your text
.
This works with any HTML elements, such as paragraphs, divs, tables, etc.
Article Page breaks
In Joomla you can split the text of an article into multiple pages using page breaks.
You can output these different pages separately via the page
attribute.
For instance, to only output the 3rd page of an article, you can do:
[text page="3"]
Or use the given title for that page, like:
[text page="My Third Page"]