Skip to content
Heiko Lübbe edited this page Dec 20, 2023 · 18 revisions

Joomla Module zitat-service.de 🇬🇧

The Joomla module displays a random quote from the collection of the user community www.zitat-service.de/en/. The selection of quotes can be limited to one of the five languages, one of the over 500 authors, one of the over 500 categories, or the quotes set by the users themselves. We have been online since 2007, free of charge and without advertisements.

Note

There is a Joomla 5 demo site for the module: joomla.zitat-service.de/en/

Installation

The Joomla module zitat-service.de supports Joomla versions 3, 4, and 5. The module can be installed in the Joomla backend as administrator via Install Extensions:

Basic Configuration

As with any newly installed Joomla module, an initial configuration is necessary to make the module visible. As a Joomla administrator, navigate to System | Site Modules | zitat-service.de:

  1. Position: e.g., Sidebar-Right
  2. Status: Published
  3. Menu Assignment: (typically) On all pages

Tip

Short notes at the input fields are displayed with Toggle Inline Help.

Module Parameters

With the basic options of the module, it is possible to limit the displayed quotes to:

  • a specific Author (e.g., Goethe),
  • a Category (e.g., Football), or
  • a User.

Here, users are the login names of the members who created the quotes. This allows you to select the quotes you have created yourself, for example.

The selection * represents all authors, all categories, and all users.

There are three fundamental choices for the language of the quote:

  • English – as an example of a specific language.
  • frontend – for quotes in the language used by Joomla. If a language is not supported, English is used.
  • all – to display quotes in all languages.

Advanced Module Parameters

The Advanced tab provides additional customization options.

The quotes are linked, and if available, the author and the source are also linked. These links open in the same browser window/tab. To have the links open in a different browser window/tab, a name such as quote_links should be entered in Target for HTML Links.

The Query Method sets how the quote is fetched. The recommended query method is Asynchronous with JavaScript in the web browser. This method fetches the quote in parallel with the page load, thus speeding up the page loading process. Conversely, with the From Joomla query method, the quote is fetched along with the page load. An advantage here is that this allows the module to be embedded multiple times on a page.

Since the asynchronous query method fetches the quote after the page has already been loaded, subsequent modules might jump. Therefore, the module should be the last in a series (to allow space below) or keep a horizontal space reserved. The minimum height of the module can be specified with the Height parameter. A minimum height can be set, for example, to 20ex or 200px. The category WebDesignTest with the language selection all is well suited for testing the height, as it contains the shortest and longest quotes.

Tip

Or the module is placed at the bottom of the page.

Styling

The displayed quote can be styled using Cascading Style Sheets (CSS). The DIV element of the quote class encloses the entire quote, where, for example, a border can be set. It contains two DIV elements of the classes quotation for the quote and source for the author and source. The following example removes the standard link decoration (underline), sets the quote in black font and larger than normal. The source (whether with or without a link) is then displayed in grey:

styling_en

To do this, create a New File in the CSS directory of the used template:

div.quote * a {
  text-decoration: none;
  color: black;
  font-size: larger;
}
div.quote div.source, div.quote div.source a {
  color: gray;
}

Examples on the Internet

Quotes in German

Quotes in English

styled

As of: 16 December 2023

Error Situations

404 No quote found for given parameters

If the parameters are combined unfavorably, no quote remains available for selection. In the following example, the language Spanish and the author Douglas Adams were configured. However, there are no quotes from Douglas Adams stored in Spanish:

404 No quote found for given parameters: language=es (Spanish), authorId=345 (Douglas Adams). "https://api.zitat-service.de/v1/quote_html?contentOnly=true&V_2.0.1_5.0.0_S&language=es&authorId=345"

👉 Select the parameters so that quotations are still found.


Error: Failed to fetch (refused to connect)

If CSP (Content Security Policy) is enabled and an error message occurs, such as

Error: Failed to fetch "https://api.zitat-service.de/v1/quote_html?contentOnly=true&language=en"

Please check the error in the JavaScript console of the browser. If you find the following there:

zitatservice.js:32 Refused to connect to 'https://api.zitat-service.de/v1/quote_html?contentOnly=true&language=en' because it violates the document's Content Security Policy.

👉 Then the CSP (Content Security Policy) configuration of the website must be supplemented with connect-src for the API in order to be able to fetch the quotes from there. For example in an Apache configuration:

# CSP
Header set Content-Security-Policy "connect-src 'self' api.zitat-service.de;"

👉 Alternatively, the 'Query method' for the module can be changed to 'From Joomla'.


RuntimeException Connection timed out

A maximum of three seconds is allowed for retrieving a quote. If the time is exceeded, an error message is displayed, such as

RuntimeException Connection timed out after 3000 milliseconds "https://api.zitat-service.de/v1/quote_html?contentOnly=true"

👉 This could occur with a very poor network connection. If the service is really unavailable, please create an issue.


Error: Invalid data "Goethe" for parameter "authorId"

In older plugin versions (before 2.0.0), names were used for configured parameters, but these no longer work after an update of the plugin. In the following example, Goethe was saved as author:

Error: Invalid data "Goethe" for parameter "authorId". "https://api.zitat-service.de/v1/quote_html?contentOnly=true&authorId=Goethe"

👉 After updating the plugin to a version from 2.0.0, saved parameters such as author, category and user must be reselected once in order to switch to the unique IDs.


Tickets

Is there a bug or is an improvement needed? Please create a GitHub Issue. 👍