Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted May 11, 20186 yr 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.
May 14, 20186 yr If you pass the full parsed language string to the error() method it will be displayed.
May 19, 20186 yr Author 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()?
May 21, 20186 yr Author 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...)
May 21, 20186 yr Author 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.
May 22, 20186 yr 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.
May 22, 20186 yr Author 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().
May 23, 20186 yr Are you passing the <a> HTML tags in the variable? If so you need to use htmlsprintf option to addToStack() instead of sprintf.
May 23, 20186 yr Author 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.
Archived
This topic is now archived and is closed to further replies.