Thomas Sutton | 1 Apr 06:28

#ECHO?

Hi folks,

I've wanted something like echo(1) in SPIP templates a few times (so  
that I can handle strings embedded in the templates in the same way  
as values from loops, etc.). While [(#REM|sinon{Stuff to echo}|...)]  
works, it is a bit dodgy, so I spent a few minutes and came up with  
the following:

> function balise_ECHO($p) {
> 	$p->code = "''";
> 	if (($v = interprete_argument_balise(1,$p))!==NULL){
> 		$p->code = $v;
> 	}
> 	return $p;
> }

I doing so, I found that `interprete_argument_balise()` seems to  
return the value wrapped in ' and '. Is it safe to assume that  
`balise_...()` functions can always use values returned by  
`interprete_argument_balise()` as `$p->code` in this way?

Regards,

Thomas Sutton
Web Developer
bouncingorange
graphic + web design
Attachment (smime.p7s): application/pkcs7-signature, 2433 bytes
Pierre Andrews | 1 Apr 19:08
Picon
Favicon
Gravatar

Re: #ECHO?

Thomas Sutton <thomas@...> wrote:
 > I doing so, I found that `interprete_argument_balise()` seems to  
> return the value wrapped in ' and '. Is it safe to assume that  
> `balise_...()` functions can always use values returned by  
> `interprete_argument_balise()` as `$p->code` in this way?

I am not sure to understand the question there Thomas.

If I remember well, interprete_argument_balise() returns php code for each 
arguments. So, if the argument is a static string, it's '...', but it could be 
any php code that returns a string I think.

Pierre

Gilles Vincent | 1 Apr 23:37
Picon
Gravatar

Re: #ECHO?

I don't understand what you are trying to do.
Do you mean #EVAL{$p} ?

On Tue, Apr 1, 2008 at 6:28 AM, Thomas Sutton
<thomas@...> wrote:
> Hi folks,
>
>  I've wanted something like echo(1) in SPIP templates a few times (so
>  that I can handle strings embedded in the templates in the same way
>  as values from loops, etc.). While [(#REM|sinon{Stuff to echo}|...)]
>  works, it is a bit dodgy, so I spent a few minutes and came up with
>  the following:
>
>  > function balise_ECHO($p) {
>  >       $p->code = "''";
>  >       if (($v = interprete_argument_balise(1,$p))!==NULL){
>  >               $p->code = $v;
>  >       }
>  >       return $p;
>  > }
>
>  I doing so, I found that `interprete_argument_balise()` seems to
>  return the value wrapped in ' and '. Is it safe to assume that
>  `balise_...()` functions can always use values returned by
>  `interprete_argument_balise()` as `$p->code` in this way?
>
>  Regards,
>
>  Thomas Sutton
>  Web Developer
(Continue reading)

Thomas Sutton | 2 Apr 03:34

Re: #ECHO?

On 02/04/2008, at 5:37 AM, Gilles Vincent wrote:

I don't understand what you are trying to do.
Do you mean #EVAL{$p} ?

I implemented an #ECHO tag. It takes a single argument and returns it. It's of no use except as a way to get some text hard-coded in the template to some filters, e.g., image_typo. The only reason I want it is so that I can use image_typo to produce my hard-coded text in footers, "home" navigation links, etc:

[(#REM) Hard-coded text ]
[(#ECHO{Copyright 2008 bouncingorange }|image_typo{police=silkscreen.ttf,taille=6})]
[(#REM) Similarly treated dynamic text ]
<BOUCLE_foot(RUBRIQUES){id_parent=5}{par num titre}>
<li><a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero|image_typo{police=silkscreen.ttf,taille=6})]</a></li> </BOUCLE_foot>


The question is about the interprete_argument_balise() function: can I assume that the values it returns are always safe to use in the $p->code value returned by a tag? According to Pierre the answer is yes: it should always be a piece of PHP code.


On Tue, Apr 1, 2008 at 6:28 AM, Thomas Sutton <thomas-wT9aXh5S2t8LQszSOs697tBPR1lH4CV8@public.gmane.org> wrote:
Hi folks,

 I've wanted something like echo(1) in SPIP templates a few times (so
 that I can handle strings embedded in the templates in the same way
 as values from loops, etc.). While [(#REM|sinon{Stuff to echo}|...)]
 works, it is a bit dodgy, so I spent a few minutes and came up with
 the following:

function balise_ECHO($p) {
      $p->code = "''";
      if (($v = interprete_argument_balise(1,$p))!==NULL){
              $p->code = $v;
      }
      return $p;
}

 I doing so, I found that `interprete_argument_balise()` seems to
 return the value wrapped in ' and '. Is it safe to assume that
 `balise_...()` functions can always use values returned by
 `interprete_argument_balise()` as `$p->code` in this way?

Regards,

Thomas Sutton
Web Developer
bouncingorange
graphic + web design
Attachment (smime.p7s): application/pkcs7-signature, 2433 bytes
Gilles Vincent | 2 Apr 09:46
Picon
Gravatar

Re: #ECHO?

On Wed, Apr 2, 2008 at 3:34 AM, Thomas Sutton
<thomas@...> wrote:
> I implemented an #ECHO tag. It takes a single argument and returns it. It's
> of no use except as a way to get some text hard-coded in the template to
> some filters, e.g., image_typo. The only reason I want it is so that I can
> use image_typo to produce my hard-coded text in footers, "home" navigation
> links, etc:

OK I understand now.
What you wnt is exactly what already use the (bad commented) tags #GET / #SET

>
>  [(#REM) Hard-coded text ]
>  [(#ECHO{Copyright 2008 bouncingorange
> }|image_typo{police=silkscreen.ttf,taille=6})] [(#REM) Similarly treated
> dynamic text ]

You can do this :

#SET{copyright,Copyright 2008 bouncingorange}
[(#GET{copyright}image_typo{police=silkscreen.ttf,taille=6})]

>  <BOUCLE_foot(RUBRIQUES){id_parent=5}{par num titre}> <li><a
> href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero|image_typo{police=silkscreen.ttf,taille=6})]</a></li>
> </BOUCLE_foot>
>
>
> The question is about the interprete_argument_balise() function: can I
> assume that the values it returns are always safe to use in the $p->code
> value returned by a tag? According to Pierre the answer is yes: it should
> always be a piece of PHP code.
>

The solution is certainly in the code of #GET.
But in your case I don't think that it's necessary to re-invent the wheel..

>
>
> On Tue, Apr 1, 2008 at 6:28 AM, Thomas Sutton <thomas@...>
> wrote:
> Hi folks,
>
>  I've wanted something like echo(1) in SPIP templates a few times (so
>  that I can handle strings embedded in the templates in the same way
>  as values from loops, etc.). While [(#REM|sinon{Stuff to echo}|...)]
>  works, it is a bit dodgy, so I spent a few minutes and came up with
>  the following:
>
>
> function balise_ECHO($p) {
>       $p->code = "''";
>       if (($v = interprete_argument_balise(1,$p))!==NULL){
>               $p->code = $v;
>       }
>       return $p;
> }
>
>  I doing so, I found that `interprete_argument_balise()` seems to
>  return the value wrapped in ' and '. Is it safe to assume that
>  `balise_...()` functions can always use values returned by
>  `interprete_argument_balise()` as `$p->code` in this way?
>
> Regards,
>
>
>
> Thomas Sutton
> Web Developer
> bouncingorange
> graphic + web design
JLuc | 2 Apr 10:42
Favicon

Re: #ECHO?

Gilles Vincent a écrit :
> On Wed, Apr 2, 2008 at 3:34 AM, Thomas Sutton
<thomas@...> wrote:
>> I implemented an #ECHO tag. It takes a single argument and returns it. It's
>> of no use except as a way to get some text hard-coded in the template to
>> some filters, e.g., image_typo. The only reason I want it is so that I can
>> use image_typo to produce my hard-coded text in footers, "home" navigation
>> links, etc:
> 
> OK I understand now.
it could (aswell|rather) be called 'idem' or 'id'

JL

Gilles Vincent | 3 Apr 04:03
Picon
Gravatar

call for comments on an article

That is a draft for the documentation on spip.net :
Can you give me some feedback ?

During the normal execution of several commands, call-outs are made to
optional scripts that allow a developer to add functionality or
checking. Typically, the hooks allow for a command to change the
values of function arguments before any other call, and allow for a
post-processing treatment that will always change the function result.

Exemple :
function prefix_treatment($flow) {
   /* add something to the flow */
   $flow .= 'This is some html code';
   return $flow;
}

plugin.xml defines the implemented hooks with a list of <pipeline> markups:
<pipeline>
 <nom>point_entree</nom>
 <action>fonction</action>
 <inclure>fichier.php</inclure>
</pipeline>

Composition : 3 markups
<nom> : name of the hook (from a list defined in ecrire/inc_version.php)
<action> : function name without it's prefix
<inclure> : file name that defines the previous function. It's name
must be prefix_action

More details : http://doc.spip.org/ <at> Tuto-Se-servir-des-points-d-entree
(this is a simplified translation of the first part. The other ones are :
- an more advanced exemple
- a list (incomplete) of the existing hooks

.Gilles
craig | 3 Apr 09:35

forms_et_tables_1_9_1 not working

Hello all,

I have installed the above plug-in, which is working great on testing.

But when I put it on live it is not working, I cannot add any Champs, when i 
click on add, nothing happens.

Does anyone know how i could fix it?

Thanks in Advance
Craig

Thomas Sutton | 4 Apr 05:43

Documents from the web

Hi all, 

We're going to be using a dedicated server for hosting some large media files and want to treat them as documents in SPIP. Unfortunately, it doesn't seem to work: we can upload an FLV file as an attachment successfully, but attempting to "reference a document on the Internet" with the same file on our media instead does not work. When attempting to do so, the action appears to time-out with no result: no document is added, no message displayed, nothing.

Does anyone have any insight as to why this might be the case and how we might work around the problem? The site uses SPIP 1.9.2c, the forms and tables plugin, and the files we're trying to upload are FLVs (which we'll treat with a modified emb.html model).

Regards,

Thomas Sutton
Web Developer
bouncingorange
graphic + web design
Attachment (smime.p7s): application/pkcs7-signature, 2433 bytes
Paolo | 4 Apr 07:58
Picon
Favicon

Re: Documents from the web

Thomas Sutton wrote:

> we can upload an FLV file as an attachment 
> successfully, but attempting to "reference a document on the Internet" 
> with the same file on our media instead does not work. 

Thomas,

I do not know whether the following is helpful...

For pages like http://www.taize.fr/en_article4768.html

We use a model: http://www.taize.fr/squelettes/modeles/flv.html

And the mediaplayer from http://www.jeroenwijering.com/

The flv files are uploaded to a separate server by ftp and referenced like this:

<flv|url=http://myserver.com/myfilm.flv|largeur=340|hauteur=270>

Paolo


Gmane