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 > html_options-Syntax
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
html_options-Syntax

Réponse
 
LinkBack Outils de la discussion
Vieux 09/10/2006, 14h49   #1
Peggy Schatz | screen-card.design
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut html_options-Syntax

Hello,

my Smarty-template contains a variety of drop-down-fields and other form
data. Layout-related data for drop-down-lists are contained in $drop
(associative array).

Trying to build form elements via Smarty I encounter problems.
If I output the following I get the desired strings, but not when
included within another smarty-plug-in-function...

working:

{$drop.fscm_1.name} - returns 'myname'
bg_{$drop.fscm_1.color} - returns 'bg_yellow'
{$drop.fscm_1.width}px - returns '100px'
{$drop.fscm_1.js} - returns 'myfunction()'

not working: (problems with class and style)

{html_options name=$drop.fscm_1.name values=$fscm_1 output=$fscm_1
class=bg_$drop.fscm_1.color style=width:$drop.fscm_1.width
onchange=$drop.fscm_1.js}

I tried double quotes, but same results.
The output is as follows:

<select name="myname" class="bg_Array.fscm_1.color"
style="width:Array.fscm_1.width" onchange="myfunction()">

Thanx for ing!

Peggy
  Réponse avec citation
Vieux 09/10/2006, 14h56   #2
messju mohr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] html_options-Syntax

On Mon, Oct 09, 2006 at 02:49:54PM +0200, Peggy Schatz | screen-card.design wrote:
> Hello,
>
> my Smarty-template contains a variety of drop-down-fields and other form
> data. Layout-related data for drop-down-lists are contained in $drop
> (associative array).
>
> Trying to build form elements via Smarty I encounter problems.
> If I output the following I get the desired strings, but not when
> included within another smarty-plug-in-function...
>
> working:
>
> {$drop.fscm_1.name} - returns 'myname'
> bg_{$drop.fscm_1.color} - returns 'bg_yellow'
> {$drop.fscm_1.width}px - returns '100px'
> {$drop.fscm_1.js} - returns 'myfunction()'
>
> not working: (problems with class and style)
>
> {html_options name=$drop.fscm_1.name values=$fscm_1 output=$fscm_1
> class=bg_$drop.fscm_1.color style=width:$drop.fscm_1.width
> onchange=$drop.fscm_1.js}
>
> I tried double quotes, but same results.
> The output is as follows:
>
> <select name="myname" class="bg_Array.fscm_1.color"
> style="width:Array.fscm_1.width" onchange="myfunction()">


read about backticks:
http://smarty.php.net/manual/en/lang...tax.quotes.php

> Thanx for ing!
>
> Peggy
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

  Réponse avec citation
Vieux 09/10/2006, 15h23   #3
Peggy Schatz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] html_options-Syntax


> read about backticks:
> http://smarty.php.net/manual/en/lang...tax.quotes.php
>
>



I had read that after I found related topics on the forum before.
Obviously I didn't set the backticks correctly. Thanks for getting me to
try once more...


The following does the job:

{html_options name=$drop.fscm_1.name values=$fscm_1 output=$fscm_1
class="bg_`$drop.fscm_1.color`" style=width:`$drop.fscm_1.width`
onchange=$drop.fscm_1.js}

Ciao, Peggy
  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 20h20.


É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,08552 seconds with 11 queries