SPIP Bonux

Enjoy the fresh functions of Bounce all over your Spip site !

This plugin will “wash” your SPIP laundry more than ever, with nice gifts inside ! Soften private user interface, loops POUR (for... to...) and CONDITION, arrays, counters, and so on...

Because we just could not put everything in SPIP 2.0 (the box was to small), here comes a plugin with little more tweaks in it ! Take it as a gift, with our kind regards !

How soft it is ! Is it new ?

According to its fans, SPIP-Bonux improves the comfort of your user experience with forms in the private area, whose colours last longer than before.

It is just a slight variation on the private area’s styles. This one now offers a new set of colours, softer for the eyes, leading to more concentration abilities on your editorial work. Bonux-gift : those forms stay accessible, even when pictures display is desactivated in the browser.

A loop (POUR) to get for... to... effects

A loop (POUR) (french equivalent for “FOR”) now lets you loop on all php arrays, although they are passed through #ENV, #GET or whatever.

<BOUCLE_test(POUR){array #ENV{array}}>
#KEY=>#VALUE<br />
</BOUCLE_test>

KEY and VALUE can then be used in criterions, as for a certain number of criterions in traditionnal SPIP’s loops (pagination for exemple)

Those arrays might already be present in <code#ENV because they are brought as an argument for an include (#INCLURE), or as a context for a CVT form, or come from any filter returning a PHP array() : (#ENV{something}|my_filter), or at last, from every tag returning an array(), like #ARRAY ...

Numerous exemples available in the plugin’s /tests/ directory.

A loop (CONDITION) to get if... then... else... effects

<BOUCLE_test(CONDITION){si #ENV{test}|>{5}}>
true
</BOUCLE_test>
false
<//B_test>

“si...” is the french for “if...”

Tags to play with arrays

SPIP already lets you initialize an array with

#SET{my_array,#ARRAY{1,first_value,2,second_value,3,third_value}}

SPIP-Bonux adds a #SET_MERGE tag which allows to merge and to allocate a value at the same time.

#SET_MERGE{name_of_my_array,#GET{my_array},#ARRAY{key,value}}

and a tag #SET_PUSH, to add any element to it :

#SET_PUSH{my_array,value}

A new criterion compteur ( = counter)

Inspired by Classer les articles par nombre de commentaires, this criterion compteur lets you count elements issued from a table, associated to elements issued from another table.

For exemple, to display authors (AUTEUR) with their number of articles :

<BOUCLE1(AUTEURS){compteur articles}{par compteur_articles}>
#ID_AUTEUR : #COMPTEUR{articles}
</BOUCLE1>

#COMPTEUR tag is associated to criterion and allows to display the counter value for each author.

Plugin originally developped by Cedric Morin, tetue and Matthieu Marcillaud.
Notice translated from French to English by Etienne BRACKERS aka ’Loiseau2nuit’.

Discussion

Aucune discussion

Comment on this article

Who are you?
  • [Log in]

To show your avatar with your message, register it first on gravatar.com (free et painless) and don’t forget to indicate your Email addresse here.

Enter your comment here

This form accepts SPIP shortcuts {{bold}} {italic} -*list [text->url] <quote> <code> and HTML code <q> <del> <ins>. To create paragraphs, just leave empty lines.

Add a document

Follow the comments: RSS 2.0 | Atom

updated on 19 November 2018