|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 http://smarty.php.net/manual/en/lang...ml.options.php You need an associative array. Just fill $arrCat with IDC as keys and CNombre as values. Then use {html_options} options attribute. Reynier Perez Mira schrieb: > I have this PHP Code: > $sql = $db->Execute("SELECT IDC, CNombre FROM os_catproductos ORDER BY IDC ASC"); > $arrCat = array(); > while ( $categorias = $sql->fetchRow() ) { > $arrCat[] = $categorias; > } > $tpl->assign('catArr', $arrCat); > > Then I need to build an SELECT working with catArr values. I try this in template: > > <select id="arrCatSELECT" id="arrCatSELECT" size="1" onchange="javascript:document.location.href='index .php?cPath={$catArr.IDC}';">{html_options values={$catArr.IDC} output=$catArr.ANombre}</select> > > But it not works. Any ? > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFD64cUtyx3EHt/UjARAhcYAJ9KpuUWlGrJkx+Ibkxulmnyg25tvwCdFz0K Vbip5+HFzxSfQ8D1UuGOZ5I= =lW62 -----END PGP SIGNATURE----- |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
I have this PHP Code:
$sql = $db->Execute("SELECT IDC, CNombre FROM os_catproductos ORDER BY IDC ASC"); $arrCat = array(); while ( $categorias = $sql->fetchRow() ) { $arrCat[] = $categorias; } $tpl->assign('catArr', $arrCat); Then I need to build an SELECT working with catArr values. I try this in template: <select id="arrCatSELECT" id="arrCatSELECT" size="1" onchange="javascript:document.location.href='index .php?cPath={$catArr.IDC}';">{html_options values={$catArr.IDC} output=$catArr.ANombre}</select> But it not works. Any ? -- ReynierPM 4to. Ing. Informática Linux User: #310201 El programador superhéroe aprende de compartir sus conocimientos. Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria sabiduría: escuchando ayudando a los demás... |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
syntax is:
{html_options values=$catArr.IDC output=$catArr.ANombre} You cannot embed delimiters. Reynier Perez Mira wrote: >I have this PHP Code: >$sql = $db->Execute("SELECT IDC, CNombre FROM os_catproductos ORDER BY IDC ASC"); >$arrCat = array(); >while ( $categorias = $sql->fetchRow() ) { > $arrCat[] = $categorias; >} >$tpl->assign('catArr', $arrCat); > >Then I need to build an SELECT working with catArr values. I try this in template: > ><select id="arrCatSELECT" id="arrCatSELECT" size="1" onchange="javascript:document.location.href='index .php?cPath={$catArr.IDC}';">{html_options values={$catArr.IDC} output=$catArr.ANombre}</select> > >But it not works. Any ? > > > |
|
![]() |
| Outils de la discussion | |
|
|