PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > Special variables in function calls
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Special variables in function calls

Réponse
 
LinkBack Outils de la discussion
Vieux 23/02/2006, 10h55   #1
Dep
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Special variables in function calls

I have a plugin function which produces some output.
In template it's called in a following way:

{my_function arg1="val1" arg2="val2"}

Is there any way to insert a value of, for example $smarty.get.my_var
for one of the arguments???
Lines below cause compiler error.

{my_function arg1="$smarty.get.my_var" arg2="val2"}
{my_function arg1="{$smarty.get.my_var}" arg2="val2"}

PS: I know that using directly request vars in templates is not a good
practice, but this is just an example

Dmitriy
  Réponse avec citation
Vieux 23/02/2006, 11h08   #2
messju mohr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Special variables in function calls

On Thu, Feb 23, 2006 at 11:55:53AM +0200, Dep wrote:
> I have a plugin function which produces some output.
> In template it's called in a following way:
>
> {my_function arg1="val1" arg2="val2"}
>
> Is there any way to insert a value of, for example $smarty.get.my_var
> for one of the arguments???
> Lines below cause compiler error.
>
> {my_function arg1="$smarty.get.my_var" arg2="val2"}
> {my_function arg1="{$smarty.get.my_var}" arg2="val2"}


{my_function arg1=$smarty.get.my_var arg2="val2"}
should work fine

for more examples see:
http://smarty.php.net/manual/en/lang...tax.quotes.php

> PS: I know that using directly request vars in templates is not a good
> practice, but this is just an example
>
> Dmitriy
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

  Réponse avec citation
Vieux 24/02/2006, 13h28   #3
Ñåðãåé Ãëàçûðèí
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Special variables in function calls

{my_function arg1="{$smarty.get.my_var}" arg2="val2"} - this is true variant of used GLOBAL variables in your template function.
-----Original Message-----
From: Dep <dep@ztu.edu.ua>
To: smarty-general@lists.php.net
Date: Thu, 23 Feb 2006 11:55:53 +0200
Subject: [SMARTY] Special variables in function calls

> I have a plugin function which produces some output.
> In template it's called in a following way:
>
> {my_function arg1="val1" arg2="val2"}
>
> Is there any way to insert a value of, for example $smarty.get.my_var
> for one of the arguments???
> Lines below cause compiler error.
>
> {my_function arg1="$smarty.get.my_var" arg2="val2"}
> {my_function arg1="{$smarty.get.my_var}" arg2="val2"}
>
> PS: I know that using directly request vars in templates is not a good
> practice, but this is just an example
>
> Dmitriy
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


  Réponse avec citation
Vieux 17/10/2006, 15h21   #4
Urb LeJeune
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Smarty support mod operator?

Does Smarty support the mod math operator?

In PHP 4 % 3 returns 1.

Urb
  Réponse avec citation
Vieux 17/10/2006, 16h42   #5
Urb LeJeune
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Smarty support mod operator? Follow up

I'm building a table and after every third <td> I want to start a
new row.

This works:

{if $smarty.section.Photos.iteration % 3 == 0}</tr>
<tr>{/if}

Urb


>.
>
>Urb
>
>--
>Smarty General Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h06.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10168 seconds with 13 queries