{"action":"created","issue":{"url":"https://api.github.com/repos/raelgc/template/issues/15","repository_url":"https://api.github.com/repos/raelgc/template","labels_url":"https://api.github.com/repos/raelgc/template/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/raelgc/template/issues/15/comments","events_url":"https://api.github.com/repos/raelgc/template/issues/15/events","html_url":"https://github.com/raelgc/template/issues/15","id":130677546,"number":15,"title":"Valor incorreto em blocos","user":{"login":"Valkhan","id":9582764,"avatar_url":"https://avatars.githubusercontent.com/u/9582764?v=3","gravatar_id":"","url":"https://api.github.com/users/Valkhan","html_url":"https://github.com/Valkhan","followers_url":"https://api.github.com/users/Valkhan/followers","following_url":"https://api.github.com/users/Valkhan/following{/other_user}","gists_url":"https://api.github.com/users/Valkhan/gists{/gist_id}","starred_url":"https://api.github.com/users/Valkhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valkhan/subscriptions","organizations_url":"https://api.github.com/users/Valkhan/orgs","repos_url":"https://api.github.com/users/Valkhan/repos","events_url":"https://api.github.com/users/Valkhan/events{/privacy}","received_events_url":"https://api.github.com/users/Valkhan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-02T13:02:53Z","updated_at":"2016-02-09T19:39:53Z","closed_at":"2016-02-09T19:39:53Z","body":"Pelo que percebi quando estamos trabalhando com laço FOR e por ventura um valor que foi informado em um LOOP anterior e não foi modificado no LOOP atual, este valor em 'cache' vai ser exibido, verifiquei que neste Issue #3 houve problema similar, porém a solução proposta lá não me resolveu (talvez por conta da versão da classe), segue exemplo abaixo:\r\n\r\nHTML:\r\n```\r\n<table>\r\n<!-- BEGIN TESTE -->\r\n<tr>\r\n\t<td>{VALOR1}</td>\r\n\t<td>{VALOR2}</td>\r\n\t<td>{VALOR3}</td>\r\n</tr>\r\n<!-- END TESTE -->\r\n</table>\r\n```\r\n\r\nPHP:\r\n```\r\n$t = new Template(__DIR__.'/temp.html');\r\n$dados = array(\r\n\tarray('valor1' => '1a','valor2' => '2a','valor3' => '3a'),\r\n\tarray('valor1' => '1b','valor2' => '2b','valor3' => '3b'),\r\n\tarray('valor1' => '1c','valor2' => '2c','valor3' => '3c')\r\n\t);\r\nfor($x = 0;$x<3;++$x){\r\n\tif($x % 2 === 0){\r\n\t\t$t->VALOR1 = $dados[$x]['valor1'];\r\n\t\t$t->VALOR2 = $dados[$x]['valor2'];\r\n\t\t$t->VALOR3 = $dados[$x]['valor3'];\r\n\t}else{\r\n\t\t$t->VALOR1 = $dados[$x]['valor1'];\r\n\t\t$t->VALOR3 = $dados[$x]['valor3'];\r\n\t}\r\n\t$t->block('TESTE');\r\n}\r\n$t->show();\r\n```\r\n\r\nVai produzir o seguinte resultado:\r\n> 1a\t| 2a | 3a\r\n> 1b | 2a | 3b\r\n> 1c\t| 2c | 3c\r\n\r\nOnde acredito que o correto seria:\r\n> 1a\t| 2a | 3a\r\n> 1b |      | 3b \r\n> 1c\t| 2c | 3c\r\n\r\nUma alternativa é zerar o valor que não foi utilizado, mas minha dúvida é, teria como ao adicionar um 'bloco' ele zerar os valores atuais das variáveis modificadas assim evitando a necessidade de informar um valor 'branco' nas variáveis não utilizadas?\r\n"},"comment":{"url":"https://api.github.com/repos/raelgc/template/issues/comments/182025314","html_url":"https://github.com/raelgc/template/issues/15#issuecomment-182025314","issue_url":"https://api.github.com/repos/raelgc/template/issues/15","id":182025314,"user":{"login":"raelgc","id":263302,"avatar_url":"https://avatars.githubusercontent.com/u/263302?v=3","gravatar_id":"","url":"https://api.github.com/users/raelgc","html_url":"https://github.com/raelgc","followers_url":"https://api.github.com/users/raelgc/followers","following_url":"https://api.github.com/users/raelgc/following{/other_user}","gists_url":"https://api.github.com/users/raelgc/gists{/gist_id}","starred_url":"https://api.github.com/users/raelgc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raelgc/subscriptions","organizations_url":"https://api.github.com/users/raelgc/orgs","repos_url":"https://api.github.com/users/raelgc/repos","events_url":"https://api.github.com/users/raelgc/events{/privacy}","received_events_url":"https://api.github.com/users/raelgc/received_events","type":"User","site_admin":false},"created_at":"2016-02-09T19:39:53Z","updated_at":"2016-02-09T19:39:53Z","body":"@Valkhan Eu atualizei a classe com o método `block` e o parâmetro `$append`. Testei aqui e funcionou como o esperado (desde que passe o valor `false` pra `$append`."}}