[spip-dev] Passing an array in the #ENV of a template (and: SPIP is great!)

Hi all,

I'm writing a tag that needs to pass an array of options into a template and then loop over the values in it (generation <option> tags). When I've needed to do this in the past, I serialize()d the array in the tag, and then embedded PHP in the template to unserialize() and then loop over this value.

Is there a better way to achieve this (without having to add new types of SPIP loops or defining another template that conditionally includes itself)?

On another note, for the SPIP developers:

I have been working on a plug-in with tags that call other tags (like #INCLUDE/#INCLURE and #ENV/#GET/#CONFIG) and dynamic tags that build global data-structures during template compilation and then use them during the code generation phase. Whoever designed this part of the system is very clever indeed! SPIP has (in my opinion) a number of rough spots, but this is certainly not one of them! It's a please to work with.

Thanks,

Thomas Sutton

Web Developer
bouncingorange
graphic + web design

P.S.: Please pardon my English on a French list.

Thomas Sutton a écrit :

I'm writing a tag that needs to pass an array of options into a template and then loop over the values in it (generation <option> tags). When I've needed to do this in the past, I serialize()d the array in the tag, and then embedded PHP in the template to unserialize() and then loop over this value.

Is there a better way to achieve this (without having to add new types of SPIP loops or defining another template that conditionally includes itself)?

Are you aware of

?

JLuc

Hi all,

I'm writing a tag that needs to pass an array of options into a template
and then loop over the values in it (generation <option> tags). When
I've needed to do this in the past, I serialize()d the array in the tag,
and then embedded PHP in the template to unserialize() and then loop
over this value.

Is there a better way to achieve this (without having to add new types
of SPIP loops or defining another template that conditionally includes
itself)?

What are the version of your SPIP ? 2.0 ?
The plugin "SPIP-Bonux" lets you play with array looping thanks to the POUR (for) loop.

<BOUCLE_my_loop(POUR){tableau #ENV{my_array}}>
  #CLE (key)
  #VALEUR (value)
</BOUCLE_my_loop>

It is the most very mega super ultimate simple solution.
More and more plugins create a dependency with Bonux ( <necessite id="spip_bonux" version="[1.2;]" /> ) just for this feature.

The same plugin offers you a condition loop in order to do others loops *inside* the condition: because you can't loop inside conditional tags like [(#TAG|condition|oui) a conditional thing without loops].

<BOUCLE_test(CONDITION){si #TAG|condition|blabla}>
  if true
  <BOUCLE_yeah(ARTICLES)>
  wow so cool, I can make loops here
  </BOUCLE_yeah>
</BOUCLE_test>
  if false
<//B_test>

On another note, for the SPIP developers:

I have been working on a plug-in with tags that call other tags (like
#INCLUDE/#INCLURE and #ENV/#GET/#CONFIG) and dynamic tags that build
global data-structures during template compilation and then use them
during the code generation phase. Whoever designed this part of the
system is very clever indeed! SPIP has (in my opinion) a number of rough
spots, but this is certainly not one of them! It's a please to work with.

If you please playing with dynamic tags, and if you are using SPIP 2, have you heard of the new layer CVT = Charger-Vérifier-Traiter = Load-Verify-Process. It's a method less esoteric than the "balise_" one, but it's in fact a layer *over* the former method. So you can also use a combination.

There is an explanation in french here:

and here:

Shortly : the mecanism CVT is a functional cutting of the function balise_THING_dyn($params).

But you can always use balise_THING_stat() if you have to recuparate variables from the environment.

Exemple:

and:

I hope this helps you...

And I miss that : the documentation (in english!) of this plugin
http://www.spip-contrib.net/SPIP-Bounce

Hello,
I don’t know why in the public aria of my SPIP site give an error that because of a problem with My SQL Server problem, I do not have access to this part of the site. But After a few minutes it works again and I have access.
Can anybody say how to fix it?
All the best
Kamran

It seems that your MySQL server goes up and down.

Jadi

-----Original Message-----
From: kamran Mir Hazar <kamran_mirhazar@yahoo.com>
Reply-to: kamran Mir Hazar editor@kabulpress.org
To: spip-en spip-en <spip-en@rezo.net>
Subject: [Spip-en] My SQL Server
Date: Mon, 23 Mar 2009 03:33:27 -0700 (PDT)

Hello, I don’t know why in the public aria of my SPIP site give an error that because of a problem with My SQL Server problem, I do not have access to this part of the site. But After a few minutes it works again and I have access. Can anybody say how to fix it? All the best Kamran

_______________________________________________
[spip-en@rezo.net](mailto:spip-en@rezo.net) - [http://listes.rezo.net/mailman/listinfo/spip-en](http://listes.rezo.net/mailman/listinfo/spip-en)