Nette 2.1.0 (stable): Issue with form n:name macro and other macros in HTML attributes

Notice: This thread is very old.
_Martin_
Generous Backer | 679
+
0
-

Following Latte code

<textarea n:name="summary" placeholder="{_ 'write summary here'}" rows="3" class="input-xxlarge span10">{$form['summary']->value}</textarea>

generates broken PHP

<textarea placeholder="<?php echo htmlSpecialChars($template-><?php echo $_input->getControl()->getHtml() ?></textarea>

It's not a bug in translation macro, placeholder="{$basePath}" generates broken code too, but in another way:

<textarea placeholder="<?php echo htmlSpecialChars($basePath) ;echo $_input->getControl()->getHtml() ?></textarea>

Last edited by _Martin_ (2014-01-19 14:14)

_Martin_
Generous Backer | 679
+
0
-

It seems like paired tags issue: textarea fails, input is OK.

Filip Procházka
Moderator | 4668
+
0
-

This does not look like a code generated by translation macro, paste the whole generated tag.

_Martin_
Generous Backer | 679
+
0
-

I don't use default translation macro, but this https://componette.org/search/?…. That's reason, why I mentioned second example without translation macro.

Check this another example, generated code is exactly the same, as in translation macro:

<textarea n:name="summary" placeholder="{10|number:2}" rows="3" class="input-xxlarge span10">{$form['summary']->value}</textarea>

And generated code:

<textarea placeholder="<?php echo htmlSpecialChars($template-><?php echo $_input->getControl()->getHtml() ?></textarea>

Last edited by _Martin_ (2014-01-19 15:46)

David Grudl
Nette Core | 8228
+
0
-

Problem is here https://github.com/…rmMacros.php#L194.

Finding the end of HTML tag is tricky (same here https://github.com/…UIMacros.php#L306), there should be some way how do it correctly.