Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

{$foo.$bar} no i lipa...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish
View previous topic :: View next topic  
Author Message
ypcat
Smarty n00b


Joined: 13 Feb 2007
Posts: 0

PostPosted: Tue Feb 13, 2007 2:52 pm    Post subject: {$foo.$bar} no i lipa... Reply with quote

Witam wszystkich Smile
Mam pytanie, w jaki sposób mozna w smarty odwo?ywa? do czego? takiego. Mam taka tabele $GLOBALS['strona']['daneFormularza'];
Code:

Array ( [pytanie] => Twoj ulubiony system [odp1] => linux [odp2] => unix  )

Interesuj? mnie pola odp1...odpn (z reszta nie ma problemu)

Specjalnie do indeksowania po tej tabeli zrobilem sobie druga, $GLOBALS['strona']['odp']
Code:

Array ( [0] => odp1 [1] => odp2 [2] => odp3 [3] => odp4 [4] => odp5 [5] => odp6 [6] => odp7 [7] => odp8 [8] => odp9 [9] => odp10 [10] => odp11 )


no i w pliku szablonu zgodnie z dokumentacj? chcia?em zrobic to tak:
Code:

{section name=nr loop=$strona.odp}
{$strona.daneFormularza.$strona.odp[nr]}
{/section}

no i zawiodlem sie ;( nie chce mi to przejsc. bylbym bardzo wdzieczny za jakakolwiek wskazowke.
Pozdrawiam,
ypcat
Back to top
View user's profile Send private message
Marcinnn
Smarty n00b


Joined: 01 Oct 2007
Posts: 0

PostPosted: Mon Oct 01, 2007 10:11 pm    Post subject: Reply with quote

No nie?le. Mi w ogóle odpalenie smarty nie dzia?a.
Back to top
View user's profile Send private message
Marcinnn
Smarty n00b


Joined: 01 Oct 2007
Posts: 0

PostPosted: Mon Oct 01, 2007 10:12 pm    Post subject: eh Reply with quote

No nie?le. Mi w ogóle odpalenie smarty nie dzia?a.
Back to top
View user's profile Send private message
Marcinnn
Smarty n00b


Joined: 01 Oct 2007
Posts: 0

PostPosted: Mon Oct 01, 2007 10:12 pm    Post subject: eh Reply with quote

No niezle. Mi w ogole odpalenie smarty nie dzia?a.
Back to top
View user's profile Send private message
V3rit4S
Smarty n00b


Joined: 18 Nov 2007
Posts: 0
Location: Poland

PostPosted: Sun Nov 18, 2007 11:26 pm    Post subject: Reply with quote

Chcesz na podstawie tej tablicy zrobi? formularz tak ?

Zacznij od
Code:
$smarty->assign("strona_formularz", $GLOBALS['strona']['daneFormularza']);


a potem w template mozesz zrobi? tak:
- do pytania odwo?ujesz sie przez {$strona_formularz.pytanie}
- a do odpowiedzi robisz takie co? {$strona_formularz.odp1} {$strona_formularz.odp2}

a najlepiej aby? zagnie?dza? tablice:
Code:

Array
(
    [pytanie] => Tresc pytania
    [odpowiedzi] => Array
        (
            [0] => pierwsza odp
            [1] => druga odp
            [2] => kolejna odp
        )

)

Wtedy sk?adnia smarty jest prosta
Pytanie
Code:
{$strona_formularz.pytanie}

Odpowiedzi
Code:
{foreach from=$strona_formularz.odpowiedzi item=odp}
odpowiedz: {$odp}
{/foreach}


Pisane z palca ale mam nadzieje ze zadzia?a Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP