Hello... I've added an HTML block to my homepage with a "Welcome" message. It's all good except that my site is bilingual... I can of course create a language key to write the welcome message in each language. But how do I make the HTML block use a language key...? What's the best way to do this...? Any ideas or suggestions greatly appreciated! |
I personally wouldn't do it this way (if even it can be done).
I'd use javascript to:
- add the Welcome message in each language available
- in that script query the language that the user has set in dolphin
- display the output for that language in the HTML block
- copy all that javascript code into the HTML block
This shouldn't be too hard to do.
|
Just use the code highlighted in red in your html block. Make sure you toggle off TinyMCE!
<bx_text:_welcome_message /> ( _welcome_message is the language key name )
(Whatever name you use for the key name MAKE SURE there is a single space before the forward slash.. otherwise it won't work)
Then in admin >settings > language settings > Add Key
Key Name: _welcome_message
Then just add your welcome message for all the different languages and save. Done.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Brilliant! Thank you guys! :-) |
...except... after I add the line <bx_text:_welcome_text_title /> in my html block and save, the line just disappears (_welcome_text_title is my variable). I even tried adding other code to see what effect it had. So if I add to the HTML block the following:
<h1>test</h1> <bx_text:_welcome_text_title /> <h1>test2</h1>
After I save, and check again the code in the HTML block, I find that it has magically changed to:
<h1>test</h1> <h1>test2</h1>
The "<bx_text:_welcome_text_title />" is just "automatically removed" somehow...
Ideas...? :-\
|
This is happening because several years ago, Boonex did something really stupid. They added TinyMCE to the HTML block. TinyMCE will strip out all kinds of code even if you toggle it off. I usually remove it altogether from the HTML block editor
Here's how: https://www.boonex.com/forums/topic/Adsense-stripping-again-.htm#266172
Or you can just replace your /inc/classes/BxDolPageViewAdmin.php with the one I've attached (7.2.1 version)
This will remove the TinyMCE editor entirely, and your html block editor will look like the one in the screen shot above. You'll no longer have to worry about code being stripped.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Excellent...! Thank you, HL! :-) |
OK, the HTML editor works great now... However my bx_text code displays nothing (blank). Not only I've triple-checked that I have the correct language variable name, but I also tried using another language variable which is displaying OK elsewhere in my site (_XF_Home). In my HTML block I have:
<h1>test3</h1> <bx_text:_welcome_text_title /> <bx_text:_XF_Home /> <bx_text:_welcome_text_2 /> <bx_text:_welcome_text_3 /> <h2>test4</h2>
And all I see is the attached...
|
The only way that screen shot is possible, is if everything between your head tags is stripped out. Have you cleared the /cache folder?
Even if there were no language keys added, you would see this:
test3
_welcome_text_title _XF_Home _welcome_text_2 _welcome_text_3
test4
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
One other way it is possible, is if your string text field for your language key entry is empty My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Hello HL, many thanks for your feedback... The strings are not empty, and I had included _XF_Home because that one was showing up OK elsewhere. I cleared the cache ("All") via Admin panel, but even so I see lots of files in the .../public_html/dolph/cache folder (mostly very recent files, but there's a file from November in the .../cache/CSS folder and another from October in the .../cache/URI folder ) There's also the file .htaccess which I believe I should not touch (?)
I found something interesting... Even as I have the space and "/" after the string fields (as seen in the attached HTML_Block.jpg, when I go to Firebug (firebug.jpg) , there is no space or "/" after the string. Would this make sense...?
|
You should consider getting rid of that extra > after the last h2 tag in this screen shot.
As far as your other screen shot, it makes no sense at all. It's like there's an opening and closing tag for each of your custom tag., ie, <bx_text:_welcome_text_title> and later </bx_text:_welcome_text_title>
How in hell you get all the garbage code shown below from what is shown in the code area above, I can't even begin to explain. You didn't do something weird when adding the language strings, did you?
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Here's an idea: Go to admin > Tools > Cache
Uncheck Enable cache for HTML files
Clear cache
Then see if it behaves normally. I think there's a fuckedupedness in Boonex's HTML files caching.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
I keep most of the caching off since the beginning of using Dolphin due to issues with caching. Deano has stated in many posts when people had issues to turn off caching. My first problem was with the CSS caching in which the CSS for the site would fail to load. Turning off CSS caching and clearing and the problem never returned.
I think Boonex needs to revisit all of the Boonex caching; I am not sure if any of it has been updated. There certainly have been issues with more than just the HTML caching.
Geeks, making the world a better place |
Hello,
i dont know about ElAmargo but i tried exactly the same and the unchecking of HTML enablement is the solution in my case.........
Many thanks !!!!!!
|
YES! I unchecked "Enable cache for HTML files" and it now works as it should...! Thank you all (specially HL) for your patience and insight...! |