![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Przyjaciele php.pl Postów: 215 Pomógł: 0 Dołączył: 28.10.2003 Skąd: - Ostrzeżenie: (0%) ![]() ![]() |
Witam,
[php:1:985482a1f2]<?php $rs = $db->GetAll("SELECT idArtykulu, tytul FROM pages"); ?>[/php:1:985482a1f2] wynikiem jest ... Kod Array ( [0] => Array ( [idArtykulu] => 1 [tytul] => Jakiś tam ) [1] => Array ( [idArtykulu] => 2 [tytul] => Jakiś tam ) )
Problem: Z wynikow otrzymanych z bazy danych musze utworzyc List/Menu [xml:1:985482a1f2] <select name="_pageId" class="input"> <option label="{$idArtykulu}" value="{$idArtykulu}">{$tytul}</option> </select> [/xml:1:985482a1f2] Nie znam Smarty na tyle dobrze aby poradzic sobie z tym problemem. Bardzo prosze o pomoc. pozdrawiam |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarząd Postów: 2 277 Pomógł: 6 Dołączył: 27.12.2002 Skąd: Wołów/Wrocław ![]() |
Manual jak zwykle górą
index.php: [php:1:0e707ec1fc]<?php require('Smarty.class.php'); $smarty = new Smarty; $smarty->assign('cust_options', array( 1001 => 'Joe Schmoe', 1002 => 'Jack Smith', 1003 => 'Jane Johnson', 1004 => 'Charlie Brown')); $smarty->assign('customer_id', 1001); $smarty->display('index.tpl');?>[/php:1:0e707ec1fc] index.tpl: [xml:1:0e707ec1fc]<select name=customer_id> {html_options options=$cust_options selected=$customer_id} </select>[/xml:1:0e707ec1fc] OUTPUT: [xml:1:0e707ec1fc]<select name=customer_id> <option value="1000">Joe Schmoe</option> <option value="1001" selected="selected">Jack Smith</option> <option value="1002">Jane Johnson</option> <option value="1003">Charlie Brown</option> </select>[/xml:1:0e707ec1fc] |
|
|
![]() ![]() |
![]() |
Aktualny czas: 9.10.2025 - 05:43 |