SPIP 1.8.2

Hello everyone !

Spip version 1.8.2 can be downloaded from this page:

www.spip.net/en_article3103.html

This will be the last version in the 1.8 series — the development of Spip is now moving to an SVN system (in place of CVS) and other important changes are coming up, in particular a move from .php3 extensions to .php. There may also be a reorganisation of directories and other modifications.

This version corrects most of the known bugs of version 1.8.1 and should be generally more reliable.

New features:

Interface and rendering

-  There have been numerous improvements in XHTML compatibility in the function propre() (Spip’s data passes through this function on its way from the database to be rendered as HTML). XHTML compatibility has also been improved for documents attached to or displayed in text.

-  Accessibility has been improved for tables.

-  RSS feeds are available for the site’s internal forums, for personal messages, and for the articles and news items submitted for evaluation.

-  There are new options for site syndication. Links which have dropped out of the syndicated site’s syndication file can now be automatically “unpublished”. They can even be deleted from the database after a certain amount of time. The syndication system reads more elements than before, in particular:
— remote documents (podcasting or enclosure, see below)
— dates of updates
— changes in title or content

-  It is possible to set the time (and not only the date) of an article’s publication.

Managing documents

-  Remote documents: In the box which allows you to upload a document in order to attach it to an article, it is now possible instead to “reference a document on the internet” by entering its URL. Information about those “remote” documents is integrated into the database in the same way as it is for local files. However, the file itself is not imported into the IMG/ directory.

The remote documents are referenced in the same way as local documents which are stored in the IMG/ directory: it’s possible to change their title and description; Spip makes sure of their existence and checks their size. And, in the case of images, Spip makes a local copy in order to generate thumbnails out of them.

It is even possible to systematically import these remote documents by using a filter in your template. The filter |copie_locale has the following effect: having made (if necessary) a local copy of the document (this can be long if the document is very large), it returns the local address of the imported document.

And finally Spip uses this idea of remote documents for syndication. On the one hand, it reads syndication feeds containing attached documents (podcasting), and, on the other hand, the dist/backend.html template publishes documents attached to an article but which do not figure in the text of the article; in other words, the equivalent of what appears in the private area for the portfolio / attached documents.

-  Document Indexing: The titles and descriptions of all documents are indexed and can therefore be used thus: <BOUCLE(DOCUMENTS){recherche}{par points}{inverse}>

Wherever possible, Spip also tries to index the document’s content, in particular the following formats: HTML, TXT, PDF, RTF and DOC. This functionality can be extended to other formats by developing “extractor” scripts (for example for MP3 or OpenOffice documents).

-  Zip on upload: When you upload a document of a “forbidden” type (i.e. not listed in the table spip_types_documents), for example a .php file, Spip now offers to “zip” the file. (Up till now it just silently ignored the upload request.)

Calendar on the public site

-  With SPIP 1.8.2 it is possible to display the calendars of the private area on the public site and to build diaries using the formatting tools of these calendars. This is provided by a new criterion and three new filters. See article 3182 (in French) for further details.

New filters

-  |inserer_attribut{variable, value} forces the value of an attribute in an HTML tag, inserting the attribute if it does not already exist. Example:
[(#LOGO_ARTICLE|#URL_ARTICLE||inserer_attribut{alt,#TITRE})]

-  |alterner{1,2,3,...} will usually be used with #COMPTEUR_BOUCLE. It returns the value of one of its parameters, according to the current value of the tag to which it is applied. The number of arguments determines the periodicity of the changes. Examples:
[(#COMPTEUR_BOUCLE{'yellow','blue'})] could be used to colour odd and even-numbered rows of a table.
— This loop displays a table with a maximum of 17 articles, with 5 rows and 4 columns, completing the table with an empty cell if necessary:

<B_ar>
    <table border="1">
<BOUCLE_ar(ARTICLES){0,17}{par hasard}>
        [(#COMPTEUR_BOUCLE|alterner{'<tr>','','',''})]
                <td>#ID_ARTICLE</td>
        [(#COMPTEUR_BOUCLE|alterner{'','','','</tr>'})]
</BOUCLE_ar>
        [(#TOTAL_BOUCLE|alterner{'<td colspan="3"></td></tr>','<td colspan="2"></td></tr>','<td></td></tr>',''})]
    </table>
</B_ar>

Note: this filter is purely “numeric”. Thus if it is applied in this way: [(#ID_ARTICLE|alterner{1,2})] it will return “1” for articles with an odd-numbered ID and “2” for those with an even-numbered ID.

-  Filters for absolute URLs: the links generated by Spip, whether from shortcuts such as [->article 11] or from tags such as #URL_ARTICLE, are usually “relative” URLs, which do not give the complete address of linked resource. For some uses though, syndication for example, it is useful to have the “absolute” URL. Two new filters make this possible:
|url_absolue is applied to a URL, thus: [(#URL_ARTICLE|url_absolue)]
|liens_absolus is applied to texts and transforms the addresses of all links and images: [(#TEXTE|liens_absolus)].

(The filter |abs_url groups these two filters in one, applying |url_absolue on #URL_ARTICLE, and |liens_absolus elements such as #TEXTE.)

-  The filter |reduire_image can now resize images within a text. It can, for example, be applied to the #TEXTE tag. Another change to this filter: if 0 is given as the width or height, this means that only the other dimension is to be taken into account when calculating the reduction. Thus:
[(#LOGO_ARTICLE||reduire_image{60,0})] will generate a logo with a maximum width of 60 pixels; the height will be adjusted so as to preserve the proportions of the image.

Improvements in the syntax of templates

-  The default templates distributed with Spip are now XHTML 1.0 transitional.

-  #DOSSIER_SQUELETTE gives the directory in which the current template is situated. This tag can be used when referencing style sheets and other objects, thereby making it possible to place them elsewhere than in the root directory. Example: <link rel="stylesheet" type="text/css" href="#DOSSIER_SQUELETTE/mystyles.css" />

-  #FORMULAIRE_FORUM takes an argument which indicates the page to which a visitor is to be redirected when he or she has posted a message. By default, the return page is #URL_FORUM, but some situations require a return to the same page: [(#FORMULAIRE_FORUM{#SELF})], or to another page, specified thus: [(#FORMULAIRE_FORUM{thanks.php})].

-  Nested tags of the form: [(#TAG|filter{[(#ANOTHER_TAG|other_filter)]})] are now possible everywhere, to any level of nesting. This syntax can also be used in the criteria of loops (in this case the square brackets are not needed, and may be refused).

-  As a step towards unifying Spip’s syntax, the old tag #EXPOSER has now been replaced by #EXPOSE. (The only difference is that you now write: [(#EXPOSE{on,off})] and no longer: [(#EXPOSER|on,off)].)

-  When the criteria {statut} is applied to a loop, the default restriction that loops only return published elements is overridden. In other words, while an (ARTICLES) loop, in normal usage, returns only published articles (i.e. whose status is 'publie'), the following loop will instead show just the articles submitted for evaluation: <BOUCLE_a(ARTICLES){statut=prop}>.

In the same way, <BOUCLE_b(BREVES){statut IN prop, publie}> will display all the “submitted” and published news items. Within the loop, the tag #STATUT gives the status corresponding to each news item (thus making it possible, for example, to change the presentation according to the status via a CSS class).

-  the criterion {par ...} now accepts the names of SQL fields passed in a variable, in particular by the tag #ENV. (The absence of a variable does not generate any error.)

The sort order can be reversed for all the named fields using this notation {!par  ...}, which can replace the criterion {inverse}, especially when it is necessary to perform a complex sort on several fields at once.

To obtain an ascending sort order for some fields and descending for others, simply write several par criteria in succession.

Thus it is not difficult to write a template presenting information in a multi-column table with sort buttons on each column. You can find an example here.

* *

As is usual, these new features will gradually be integrated into the documentation.

Author Paolo Published : Updated : 29/08/22

Translations : عربي, català, Deutsch, English, Español, français, italiano