Skip to content

NicolasGraph/oui_quote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oui_quote

Easily display your own quote or pull one from the following services:

Download | Donate

Table of contents

Plugin requirements

oui_quote’s minimum requirements:

  • Textpattern 4.6+

Installation

  1. Paste the content of the plugin file under the Admin > Plugins, upload it and install;
  2. Click Options or visit your Admin>Preferences tab to fill the plugin prefs.

Preferences / options

  • ServiceDefault: none – The service you want to use to pull the quote;
  • QuoteDefault: unset – The quote in use (automatically filled if a service is selected);
  • ReferenceDefault: unset – The reference of the quote in use (automatically filled by Le Monde only);
  • AuthorDefault: unset – The author of the quote (automatically filled if a service is selected);
  • UrlDefault: unset – The url of the quote source (automatically filled if a service is selected);
  • Cache timeDefault: 60 – Duration of the cache in minutes; avoid too many external queries.

Tags

oui_quote

<txp:oui_quote />

or

<txp:oui_quote>
[…]
</txp:oui_quote>

Displays the quote.

Attributes

(Alphabetical order)

  • class="…"Default: unset – The css class to apply to the HTML tag assigned to wraptag.
  • label="…"Default: unset – The label used to entitled the generated content.
  • labeltag="…"Default: unset – The HTML tag used around the value assigned to label.
  • service="…"Default: 1 if a service is selected, or 0 – display the name/link of/to the service from which the quote was pulled (usually required, read terms and conditions of use of the service in use);
  • wraptag="…"Default: figure (see here) – The HTML tag to use around the generated content.

oui_quote_body

<txp:oui_quote_body />

Displays the body of the quote.

Attributes

(Alphabetical order)

  • class="…"Default: unset – The css class to apply to the img HTML tag or to the HTML tag assigned to wraptag.
  • wraptag="…"Default: blockquote – The HTML tag to use around the generated content.

oui_quote_author

<txp:oui_quote_author />

Displays the author.

Attributes

(Alphabetical order)

  • class="…"Default: unset – The css class to apply to the HTML tag assigned to wraptag.
  • wraptag="…"Default: span – The HTML tag to use around the generated content.

oui_quote_cite

<txp:oui_quote_cite />

Displays the refernce of the quote and the service from which it was pulled.
If an the url preference is filled, it will wrap the service or the source into a link.

Attributes

(Alphabetical order)

  • class="…"Default: unset – The css class to apply to the HTML tag assigned to wraptag.
  • service="…" – _Default: 1 (inherited from the container tag) – display the name/link of the service from which the quote was pulled (usually required, read terms and conditions of use of the service in use);
  • wraptag="…"Default: cite – The HTML tag to use around the generated content.

Examples

Example 1: single tag use

<txp:oui_quote label="Citation du jour" labeltag="h1" />

when used with Le Monde will return:

<h1>Citation du jour</h1>
<figure>
    <p>Ce n'est pas parce-que vous êtes nombreux à avoir tort que vous avez raison.</p>
    <figcaption>
        <span>Bernard Werber</span>
        <cite>Le Mystère des dieux (2007) via <a href="http://dicocitations.lemonde.fr/item-5133.html">Le Monde</a></cite>
    </figcation>
</figure>

Example 2: container tag use

The previous example with the use of a container tag would look like:

<txp:oui_quote label="Citation du jour" labeltag="h1">
    <txp:oui_quote_body />
    <figcaption>
        <txp:oui_quote_author />
        <txp:oui_quote_cite />
    </figcaption>
</txp:oui_quote>

Author

Nicolas Morand
Thank you to the Textpattern community and the core team.

Licence

This plugin is distributed under GPLv2.