[SPIP] Submitted : The #LOGO_XXX tags

SPIP

Article submitted

The article « The #LOGO_XXX tags
(https://www.spip.net/ecrire/?exec=article&id_article=6740) » is submitted
for publication. on Thursday 1 September 2022.


The #LOGO_XXX tags

Thursday 1 September 2022 , by jack

Table of contents

  • Tag syntax
  • Hovering logo
  • L’argument {lien}
  • The argument {alignement} (deprecated)
  • Criterion {logo}
  • Inheritance of section logos
  • Naming convention
  • Acceptable types of logos
  • See also

The #LOGO_ tags display 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_NOM-OBJET-EDITORIAL

Tag syntax|Back to the table of contents

To display the logo

  1. #LOGO_ARTICLE

produces the following HTML code:

<

img

 (http://december.com/html/4/element/img.html)


src


=


"IMG/logo/sunset.jpg?1661940083"


class


=


"spip_logo"


width


=


"600"


height


=


"400"


alt


=


""


>

To display the logo with a link to the object

  1. #LOGO_ARTICLE *

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

Return the logo file name

  1. #LOGO_ARTICLE **

produces the following HTML code:
sunset.jpg

Return logo file path

  1. [ ( #LOGO_ARTICLE |extraire_attribut {src} ) ]

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

A timestamp (https://www.spip.net/ecrire/?exec=article&id_article=6194) is
automatically added to the address. It corresponds to the last modification
of the logo. To avoid displaying it, you can write:

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

Graphically manipulating logos
To manipulate the logos, you can use the image filters
(https://www.spip.net/ecrire/?exec=article&id_article=3476).

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

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

Hovering logo|Back to the table of contents

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.

L’argument {lien}|Back to the table of contents

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

Example:

  1. [ ( #LOGO_ARTICLE { #URL_RUBRIQUE } ) ]

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

The argument {alignement} (deprecated)[|Back to the table of

contents](#s-The-argument-deprecated)

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

Exemple:

  1. [( #LOGO_ARTICLE {right)]

produces the following HTML code:
<a href="mon-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
stylesheet handling the alignment CSS classes .spip_logo_left and
.spip_logo_right

Criterion {logo}|Back to the table of contents

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_rub_logo


(RUBRIQUES)


{racine}


{logo}


{par num_titre}


>


#LOGO_RUBRIQUE


</BOUCLE_rub_logo>

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

Inheritance of section logos[|Back to the table of

contents](#s-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
(https://www.spip.net/ecrire/?exec=article&id_article=6739).

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

Naming convention|Back to the table of contents

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-etatX.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 hover 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 logo
  • /IMG/artoff4.jpg is the n°4 mouse-over logo

Acceptable types of logos[|Back to the table of

contents](#s-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

(http://www.php.net/array)

(

‹ svg ›

)

;

`

See also|Back to the table of contents

For PHP developers

— Sent by SPIP (https://www.spip.net/)


rubon199-7e493.jpg