The #LOGO_XXX tags

The #LOGO_ tags displays the logos of editorial objects.

  • #LOGO_SITE_SPIP : website logo
  • #LOGO_ARTICLE : article logo
  • #LOGO_RUBRIQUE : section logo
  • #LOGO_AUTEUR author logo
  • #LOGO_BREVE : news logo
  • .... and more generally #LOGO_EDITORIAL_OBJECT_NAME

Tag syntax

To display the logo

#LOGO_ARTICLE

produces the following HTML code:

<img
	src="IMG/logo/sunset.jpg?1661940083"
	class="spip_logo"	
	width="600" 
	height="400"
        alt=""
>

To display the logo with a link to the object

#LOGO_ARTICLE*

produces the following HTML code:

<a href="my-super-article"><img src="IMG/logo/sunset.jpg?1661940083" class="spip_logo" width="600" height="400" alt=""></a>

Return the logo filename

#LOGO_ARTICLE**

produces the following HTML code:
sunset.jpg

Return logo file path

[(#LOGO_ARTICLE|extraire_attribut{src})]

produces the following HTML code:
IMG/logo/sunset.jpg?1661940083

A timestamp is automatically added to the address. It corresponds to the last modification of the logo. To avoid displaying it, you can write:

[(#LOGO_ARTICLE|extraire_attribut{src}|supprimer_timestamp)]

Graphically manipulating logos
To manipulate the logos, you can use the image filters.

Example : display a logo by reducing its width to 220 pixels

[(#LOGO_ARTICLE|image_reduire{220,*})]

Historically, if the "mouse-over logo" option is activated in the site configuration, SPIP allows you to add a second logo to have a mouse-over effect on the logo (roll-over effect).

In this case,
-  #LOGO_ARTICLE displays the logo with mouseover effect

In addition, two tags allow you to retrieve only one of the two logos:
-  #LOGO_ARTICLE_NORMAL displays the logo without hovering.
-  #LOGO_ARTICLE_SURVOL displays the mouse-over logo.

The argument {lien}

An argument can be added to the tag to specify a link.

Example:

[(#LOGO_ARTICLE{#URL_RUBRIQUE})]

produces the following HTML code:
<a href="latest"><img src="IMG/logo/sunset.jpg?1661940083" class="spip_logo" width="600" height="400" alt=""></a>

The argument {alignement} (deprecated)

Instead of a link, you can also specify an alignment of the logo. The possible values are left, center or right

Exemple:

[(#LOGO_ARTICLE{right)]

produces the following HTML code:
<a href="my-super-article"><img src="IMG/logo/sunset.jpg?1661940083" class="spip_logo spip_logo_right" width="600" height="400" alt=""></a>

It is strongly recommended to use #INSERT_HEAD_CSS to provide the style sheet handling the alignment CSS classes .spip_logo_left and .spip_logo_right

Criterion {logo}

At the loop level, the {logo} criterion allows you to select only those articles (or sections, etc) that have a logo. It also works in the (HIERARCHIE) loop. The reverse criterion {!logo} lists objects that do not have a logo.

<BOUCLE_sec_logo(RUBRIQUES){racine}{logo}{par num_titre}>
#LOGO_RUBRIQUE
</BOUCLE_sec_logo>

Returns the logos of the sections in the root that have a logo.

Inheritance of section logos

-  #LOGO_ARTICLE_RUBRIQUE displays the logo of the article, possibly replaced by the logo of the section if there is no specific logo for the article.

By default, the #LOGO_RUBRIQUE tag displays the logo of the current section and, if it is not defined, will automatically search for a logo for the parent section in a recursive manner.

To disable this inheritance function, you can define the constant _LOGO_RUBRIQUE_DESACTIVER_HERITAGE.

To define the default section logo, go to the "Edit > Sections" menu (http://mysite.org/ecrire?exec=rubriques).

Naming convention

As of SPIP 4.0, logos are treated as documents. They are stored in the IMG/logo/ directory by keeping their original name slightly corrected if it contains forbidden characters such as accents, white space,... or if a file with the same name already exists.

For example : /IMG/logo/sunset.jpg

Until SPIP 3.2, logos were renamed by SPIP at the time of upload with the following convention: IMG/type-stateX.ext where:

  • type is the type of editorial object attached to the logo: art (article), rub (section) ...
  • State on, off is the state of the normal or hovering logo
  • X is the id of the editorial object
  • ext is the file extension (jpg, png ou gif)

For example :

  • /IMG/arton4.jpg is the n°4 article’s logo
  • /IMG/artoff4.jpg is the n°4 mouse-over logo

Acceptable types of logos

It is possible to indicate the types of images that can be used as logos by means of the customisation variable $GLOBALS['formats_logos'].

For example, to accept only SVG files:
$GLOBALS['formats_logos'] = array('svg');

See also

For PHP developers

Author jack Published : Updated : 18/04/23

Translations : English, français, Nederlands