Midnight Modding Posted May 11, 2018 Posted May 11, 2018 1. a way to get html into an error_message? 2. when I use lang="" in the template to display a translatable lang bit, it's not parsing break tags from the editor. Why? I don't see first party translatable lang bits having anything done to them other than the lang="". Actually I think I figured out #2. I think someone just pasted directly into the editor with break tags... I went and replaced a couple with actual line breaks and it displays properly.
bfarber Posted May 14, 2018 Posted May 14, 2018 If you pass the full parsed language string to the error() method it will be displayed.
Midnight Modding Posted May 19, 2018 Author Posted May 19, 2018 I didn't just pass a key. I did the following: $text = \IPS\Member::loggedIn()->language()->addToStack( 'x_required_error', FALSE, array( 'sprintf' => array( $url, $name ) ) ); \IPS\Output::i()->error( $text, '2S177/2', 403, '' ); $name is a lang string and $url is a url with the html tags in. Are you saying the lang bit isn't parsed before the point of error()?
Midnight Modding Posted May 21, 2018 Author Posted May 21, 2018 I'm so ready to finally be done with this app. I just did html for a page that has a lot to show on it and it's so messy and I bet i will be frowning when i look at it to see what it looks like... I am probably only 1 day from being finished, finally, other than bug fixing... (edit, well and after the bug fixing, I still have to do the upgrade routine to move some db data to new locations or alter what is stored...)
Midnight Modding Posted May 21, 2018 Author Posted May 21, 2018 Am I supposed to call some particular method to parse the string or what? If it's possible to display htmnl in error(), then it must be bypassing whatever is done during normal output to parse lang bits... because it's not working.
bfarber Posted May 22, 2018 Posted May 22, 2018 I don't really understand your problem. You pass a language key (or the md5 hash as you are doing there), and HTML is supported. The template uses the |raw modifier so really you shouldn't be having any problems.
Midnight Modding Posted May 22, 2018 Author Posted May 22, 2018 Well, I was trying to have it put a link in the error message and instead of it doing so, it showed it unparsed, with the a tags and not clickable, etc... So something is up. I'll look at it again and maybe I can figure it out, but I did it just like my example above and the link was the anchor tags around a url generated with internal().
bfarber Posted May 23, 2018 Posted May 23, 2018 Are you passing the <a> HTML tags in the variable? If so you need to use htmlsprintf option to addToStack() instead of sprintf.
Midnight Modding Posted May 23, 2018 Author Posted May 23, 2018 Thanks. Wow, I knew about htmlsprintf, but then never needed it so far, so forgot all about it. I think my brain is overloaded with so many areas at once. I even looked in Lang.php and somehow still overlooked it as an option.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.