Hi all,
My question is: How can I get HTML comment tags in language variables to work inside the “User Message Template”?
——————————————————
For those who need the long story…
I am using AJAX to handle all EE forms on a client’s website.
The forms are posted using some javascript function (mootools) and the returned html is then parsed to check what feedback should be given to the user.
- The ‘html’ variable contains the returned html.
- The ‘updateLog’ function shows the message in a predefined <div> element
- ‘test’ is a mootools function to check for a substring
Example:
function testResponse(html) {
// check for messages
if ( html.test("You are now logged in") ) {
updateLog("You are now logged in.");
}
if ( html.test("You are now logged out") ) {
// done, redirect to login page
location.href="/login/";
}
}This works fine but I have to check for the actual text value.
Having multiple languages it would be better to just check for the variable name.
So instead of this:
"mbr_you_are_logged_in" =>
"You are now logged in.",I would like to do this:
"mbr_you_are_logged_in" =>
"<!--mbr_you_are_logged_in-->You are now logged in.",This way I can just check for “mbr_you_are_logged_in” and regular User Messages will still display fine (for those who have javascript turned off).
But unfortunately the “User Message Template” converts my HTML comment tag to entities, like this:
& lt;!--mbr_you_are_logged_in--& gt;You are now logged in.EDIT: It seems that the xhtml formatting in the “show_message” function in “core.output.php” is the cause.
function show_message($data, $xhtml = TRUE)
{
...Of course I could set $xhtml to FALSE, but I’m really looking for a non-hack way to do this.
Any chance there is some extension hook I can use?
Cheers.