Skip navigation.

SPIP commits

Posts tagged with "2.0"

[13993] several arguments in #INCLURE or #MODELE

, , ,

#INCLURE and #MODELE accept several parameters : the syntax used for it was #INCLURE(a){b}{c}.

This syntax has been introduced in spip1.9.1. We can also read on the official documentation :


Models are not restricted to shortcuts within the text of articles. They can also be called from within a template by using the tag #MODELE{model} or [(#MODELE{model}{p1=thing,p2=whatsit}{p3=etc}|filter...)]. But this is less new, because it is equivalent to a (static) inclusion of another template (already made possible by the tag #INCLURE).



However it was quite buggy and not really homogeneous. For ex. a few abnormal differences were found between #MODELE{my_model, ..} and #INCLURE(fond=modeles/my_model){..}.

Now, the codes with parenteses and/or several braces delimited blocks are considered as deprecated : You should write instead #INCLURE{a,b,c} and #MODELE{a,b,c}.
The old syntax is still accepted.

Ex.:
#INCLURE(fond=inc-header){type=test}{env}
#INCURE{fond=inc-header, type=test, env}
#MODELE{img,lien=article5,class=logo,align=left,lien_class=important}


You can also calculate these parameters with other static content (like tags, #MODELE and #INCLURE) :
#INCLURE{fond=inc-[(#ENV{skel}|secu)]}
#MODELE{img,lien=article5,class=logo_#LANG_LEFT,align=#LANG_LEFT}


Parentheses, brakets and filters can also be used to display elements only where #INCLURE returns a content :
Ex. :
[Lastest articles in the feed #FEED_TITLE : 
  <ul>
  (#INCLURE{fond=rss-read, url=#FEED_URL, date=#DATE}|extract_post_titles)
  </ul>
]


Edit : The first argument of an INCLURE can be calculated. The common syntax indicates that filters require parentheses. But, for reason of compatibility, the following simplified syntax is accepted :
[(#INCLURE{#CHEMIN{spip_style.css}|url_absolue_css}|compacte_css)]

Read more...

Creating custom tags for SPIP

, , , ...

On its blog, Thomas Sutton describes how to create your own static SPIP tags.

The SPIP template language has two constructions: loops (which determine the objects to be “output”) and tags (which actually output particular values). The reasonably simple syntax of tags — most look like ”#THE_TAG” — belies their power and flexibility and the ease with which we can use them to extend SPIP with additional features and integrate it with other PHP-based packages.

It's post is really well documented. I love the way Thomas precisely explains how all this stuff really works !

So I advise you to read the complete post on it's website : http://passingcuriosity.com.

The latest filters and pipelines for programmers

, , , ...

The SPIP team is really active and improve it regularly.
Here is a list of new functions that can help you develop plugins :

supprimer_objets_lies ( array($type, $id) ) :
Type : pipeline
Removes the objects of plugins linked to core objects (used when these core objects are deleted)

// http://doc.spip.org/@action_editer_message_post_supprimer
function action_editer_message_post_supprimer($id_message) {
        sql_delete("spip_messages", "id_message=".sql_quote($id_message));
        sql_delete("spip_auteurs_messages", "id_message=".sql_quote($id_message));
        pipeline('supprimer_objets_lies',array(
                array('type'=>'message','id'=>$id_message)
        ));
}


optimiser_sansref ($table, $id, $sel) :
This pipeline is called in genie/optimiser.php
It completes the removal process of orphelin objects.
(dead links between tables, that results from the suppression of articles, authors, etc)

example :
/**
 * Optimizes the database by removing orphelins forums
 *
 * @param int $n
 * @return int
 */
function forum_optimiser_base_disparus ($n){
       # detect forums that are linked to an id_rubrique that doesn't exist anymore
       $res = sql_select("forum.id_forum AS id",
                       "spip_forum AS forum
                       LEFT JOIN spip_rubriques AS rubriques
                         ON forum.id_rubrique=rubriques.id_rubrique",
                       "rubriques.id_rubrique IS NULL
                        AND forum.id_rubrique>0");

       $n+= optimiser_sansref ('spip_forum', 'id_forum', $res);
       
...
       
       return $n;
}



filtre_lien_ou_expose ($url, $text, $on=false, $class="", $title="", $rel="") :
This filter creates a link or a tag <strong class='on'>
note : class, title and rel are optional
usage ; [(#URL|lien_ou_expose{texte,condition_selection_on,class,title,rel})]
example : [(#GET{self}|parametre_url{type,public}|lien_ou_expose{<:onglet_messages_publics:>,#ENV{type,public}|=={public}})]


filtre_balise_img ($img, $alt="", $class="") :
This filter creates an <img> tag
usage : [(#CHEMIN{monimage.png}|balise_img)]
(the opposite of filtre_fichier())


filtre_icone ($link, $text, $template_name, $align="", $function="", $class="") :
This filter is a shortcut for creating icons in the templates of the private area
usage : [(#URL|icone{text,template_name,align,function,class})]

test_plugin_actif ('prefix_of_the_plugin') :
This function tests if a plugin is activated and returns a boolean.

Top 20 most used SPIP plugins (and a few more)

, , ,

This is not a fresh news, but I've just read a mail that Pat sent on SPIP-ZONE.

It give the complete records of the most used plugins, at the begining of October.
It have been calculated with the websites declared on spip.net and some other sites.

Thanks Pat for your job !

So, ladies and gentlemen, the top 20 most used plugins are :
- cfg (821)
- thickbox1 (735)
- couteau_suisse (731)
- barretypoenrichie (633)
- forms (624)
- spiplistes (503)
- crayons (501)
- wcalendar (474)
- agenda (473)
- player (453)
- sitemap (443)
- accesrestreint (360)
- rechercheetendue (281)
- corbeille (261)
- typoenluminee (252)
- article_pdf (237)
- actijour (212)
- balisesession (190)
- gestiondocuments (168)
- enviar_email (160)
- boutonstexte (149)

.. Do you want to see more ? Just read the complete article :smile:

Read more...

! SPIP2.0 (and SPIP1.92f) released

, , ,

For more details :
http://www.spip.net/fr_article3784.html

A little changelog for SPIP2.0 :
- Translation in asturiano, Burmese, Khmer (Kampuchean), Indonesian, Swedish
- Unified private interface using AJAX
- Programming interface for SQL Server (MySQL, Postgres, SQLite)
- New forms for use on the site in public and private area
- Improved interface for documents and forums (documents joints possible)
- Access to several databases from a single skeleton
- Models and pagination in AJAX by simply adding a new criterion
- Hierarchical URLs (like: http://www.example.com/sector/section1/subsection2/article_name)
- Automatic compaction of CSS and javascript files
- Amelioration of the filter system and automatic installer
- And more...

Modifications between 1.9.2e of 13 September 2008 (svn [12624])
and 1.9.2f of 10 December 2008 (svn [13443]):

- Correction of a spelling error in the language list
- Correction of the criteria {par multi titre} in MySQL 5 and utf-8 (alphabetical sorting correct even with accented characters)
- Correction of the RSS of del.icio.us
- Unification of the calculation of the date of publication (now in php) in case of time lag between php and sql
- Optimization of SQL (use of the MySQL requests cache)
- Protection of redirects urls (not < or ")
- Corrections of Ukrainian
- Fix of a security problem