Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [phptal] instrukcja warunkowa
dragon7
post 5.02.2012, 17:22:44
Post #1





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 1.10.2010

Ostrzeżenie: (0%)
-----


Witam. Mam taki problem, że warunek w poniższym przykładzie jest zawsze prawdziwy i za każdym razem wyrzuca wszystkie wiersze z tablicy

  1. <select tal:condition="mod3/results" class="text" name="id_s">
  2. <optgroup tal:condition="mod4/results" tal:repeat="opt mod4/results" tal:attributes="label opt/${mod4/what2}_name" label="a">
  3. <div tal:omit-tag="" tal:repeat="results2 mod3/results">
  4. <option tal:condition="php: results2.section_id == opt.id" tal:content="opt/id" tal:attributes="value results2/id" value="a">a</option>
  5. </div>
  6. </select><br />



Czy ktoś widzi błąd? Dodam że sprawdzałem osobno tal:content="results2/section_id" i tal:content="opt/id" i wyświetlane wartości są jak najbardziej prawidłowe. Oczywiście są różne wartości id i section_id. Czemu zatem zawsze jest prawda z warunku?

Informacje dodatkowe:
pojawia się taki błąd:
8: Trying to get property of non-object C:\Users\Adek\AppData\Local\Temp\tpl_4f2eb515_site__G_xW1A8pVdnRFhrvLUZ2Uw.php 109 Array 05.02.2012 18:13

w tym pliku i w tej linii mamy:

  1. <?php
  2. /* tag "option" from line 20 */ ;
  3. if ($ctx->results2->id == $ctx->opt->id): ;
  4. if (null !== ($_tmp_4 = ($ctx->path($ctx->results2, 'id')))): ;
  5. $_tmp_4 = ' value="'.phptal_escape($_tmp_4).'"' ;
  6. else: ;
  7. $_tmp_4 = '' ;
  8. endif ;
  9. ?>
  10.  


I jeszcze takie coś:
8: Trying to get property of non-object C:\Program Files (x86)\WebServ\httpd\strona\include\PHPTAL\PHPTAL.php(845) : eval()'d code 110 Array 05.02.2012 18:19

Ten post edytował dragon7 5.02.2012, 18:33:23
Go to the top of the page
+Quote Post
viking
post 6.02.2012, 20:09:18
Post #2





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


A spróbuj na początek

  1. php: results2.section_id EQ opt.id


--------------------
Go to the top of the page
+Quote Post
dragon7
post 6.02.2012, 21:37:15
Post #3





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 1.10.2010

Ostrzeżenie: (0%)
-----


niestety nie ma żadnej różnicy, warunek jest wiecznie prawdziwy ;/
Go to the top of the page
+Quote Post
viking
post 8.02.2012, 20:22:49
Post #4





Grupa: Zarejestrowani
Postów: 6 365
Pomógł: 1114
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


A jakie przekazujesz dane do tego warunku?


--------------------
Go to the top of the page
+Quote Post
dragon7
post 10.02.2012, 11:28:29
Post #5





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 1.10.2010

Ostrzeżenie: (0%)
-----


identyfikatory, czyli liczby całkowite

wszystko jest przekazane obiektem


Ten post edytował dragon7 10.02.2012, 11:29:07
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.04.2024 - 23:10