WebsiteBaker Community Forum
WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: susigross on June 02, 2009, 07:56:48 PM
-
The WB Code snippet Easy Multilanguage Link is useful on multilanguage sites only. It provides links to pages in other languages with the same content as the current page.
It is not necessary that all pages exist in all languages or that the page trees of different languages have the same structure.
How it works:
It is necessary to replace some kernel files, because we need a new field (I called it Page Code) in the page settings. For all pages with the same content you enter the same Page Code (you can also call it keyword).
The snippet will show the languages of all pages with the same Page Code as link menue.
There are two special Page Codes:
* home is the home page of a language. It is used when no page with the current page code is available for a language.
* none does switch off the language menu for the current page. This might be useful within a multipage form, for instance.
Add the following line to your template:
<?php easymultilang_menu(); ?>
The file HowTo.txt explains the necessary steps.
Home page of the snippet on AMASP: http://www.websitebakers.com/pages/code-snippets/various/easy-multilanguage-link.php (http://www.websitebakers.com/pages/code-snippets/various/easy-multilanguage-link.php)
-
I dont want to double the post..
https://forum.WebsiteBaker.org/index.php/topic,14312.msg89357.html#msg89357
Great job man !!!
Cheers
-
Hi,
I found the bug when you use search, the menu dissapears.. ??? Did you find the solution for this ?
You can see the example: http://wbdemo.heysoft.de/pages/en/multilingual-sites.php
cheers
-
Hi,
I found the bug when you use search, the menu dissapears.. ??? Did you find the solution for this ?
You can see the example: http://wbdemo.heysoft.de/pages/en/multilingual-sites.php
cheers
This has nothing to do with the snippet.
It is because my menu (sm2) does not show the root level.
If you are on a german language page, it does show all what is beneath http://wbdemo.heysoft.de/pages/de/
If you are on a english language page, it does show all what is beneath http://wbdemo.heysoft.de/pages/en/
If you are on the search page, it does show all what is beneath http://wbdemo.heysoft.de/search/
Because there are no subpages in the last case, the menu correctly does show nothing.
So if I would want to show the menu always, I would need to include the root level, that's all.
-
Please check this link, I put MY in search box:
http://wbdemo.heysoft.de/search/index.php?string=my&submit.x=0&submit.y=0&submit=Search&search_path=/en
The menu on the left is not visible..
I kinda fixed this problem by putting both languages in root, and it is working, so there is no need to put english pages in /en and germans in /de as language flags can separate them..
Now I have other problem, when I search something on my test site, I lose FLAGS, and I get {l_loop} text
I removed text next to flags, like you have FLAG English, Flag German.
.htt file looks like this:
<!-- BEGIN l_block -->
<span class="{CLASS}">
{ASTART}<img src="{IMG}" /> {AEND}
</span>
<!-- END l_block -->
Can you guide me how to keep the flags dissapearing :)
-
did you modified anything more in the search page or something ?
-
I tried to include this into search/index.php page but no luck, the language are still gone...
include_once(WB_PATH."/modules/easymultilang/include.php");
Maybe someone else can help, How to include function easymultilang_menu() from file /modules/easymultilang/include.php into /search/index.php page ?
-
Please check this link, I put MY in search box:
http://wbdemo.heysoft.de/search/index.php?string=my&submit.x=0&submit.y=0&submit=Search&search_path=/en
The menu on the left is not visible..
This is correct, and in my last post I explained why it is. This is not a bug, but a feature :-)
But I just found something strange you did not mention:
When I call search on the page, the language menu is still available.
But when I follow an external link to the search page, the language menu is not available.
Despite there is no much sense in a link to a search page, it is really strange. I will check this as soon as I find some time.
Can you guide me how to keep the flags dissapearing
???
did you modified anything more in the search page or something ?
No, why should I?
-
In case I didnt explain it well, on the search result page: /search/index.php the flags dissapeared.. and there is no html code for them when I view source..
Also, sometimes I get: {l_loop} text, which is also in the source..
So basicly the question now is, how to link this {l_loop} from module and search page :)
cheers
-
Also, sometimes I get: {l_loop} text, which is also in the source..
Is this reproducable? How?
-
I found it, i had nowhere "home" --as PAGE CODE set , and now flags are visible now :))
Also I noticed even on your page, the language is allways selected EXCEPT on the search page, where current language is not "selected" (on your page marked with yellow background)
Can it be marked on search page too ? I tried to change your php code but had no luck :)
Also, I think that this module should me integrated into WB 2.8..
Here is EXAMPLE:
CASE 1 , OLD Multilanguage way:
EN
- Page 1
- Page 2
-- Sub page 1
DE
- Page 1
- Page 2
-- Subpage 1
CASE 2, With this module:
Home --- EN. language
Galery --- EN language
- Video galery --- EN language
GermanHome --- DE language
GermanGalery --- DE language
- German Video Galery -- DE language
good things I found are:
I noticed that you can place pages with different languages in ROOT, and only the pages of selected languages will be displayed. (if Defult language is EN, pages in root and root+1,2,3.. levels in DE language will not be displayed )
That means that you do not have to make separate /en and /de... folders for different languages, which would be the root menu ( like in CASE 1) as most people did before. So you will not loose menu when you search -- which was bug , as your root will be displayed after search. (the bug was when you searched, on search page, only root meny was displayed and because your root menu was flags to change the language - CASE 1, menubar was empty)
And what is most important, by clicking on flags, you will be redirected to exact page on different language, and not on the root of /en or /de if you had page structure like in CASE 1..
Guys, please reconsider this :))
cheers
-
Also I noticed even on your page, the language is allways selected EXCEPT on the search page, where current language is not "selected" (on your page marked with yellow background)
Can it be marked on search page too ? I tried to change your php code but had no luck :)
I just relaesed version 0.3.0 which does not have the problem with the search page anymore :-)
A search page does not have a language, this is why no language is marked as current.
This way you can jump to the start pages of any language from search.
Also, I think that this module should me integrated into WB 2.8..
Say this to the developers...
-
Nice, just tested it and now it automaticly updates the database :)) great :-D :-D
I tested it with WB 2.8 RC1 , its working great :)
Just to mention, that "home" page code should be defined, in order to avoid {l_loop} text whch happened to me :))
Developers, it would be nice to include this to 2.8
Once again Frank, great job.. I really like this :)
-
@crnogorac081:
Developers, it would be nice to include this to 2.8
nope ... 2.8 is RC1 where RC1 means "feature freeze only bug fixing".
But nevertheless feel free to open a feature request for 2.9
http://project.websitebaker2.org/newticket
Regards Bernd
-
ok, Im just sayin this is better way to create multilanguage sites :))
Anyway, I'll post the ticket :)
-
For all those who do not want to wait for WB 2.9 to come with better multilanguage support:
I just released version 0.4 of the snippet.
It comes with patched files for WB 2.8 and a help file explaining how to patch (it is just as easy as moving some files).
After you installed the module:
- go to Add-ons - Modules
- select Easy Multilanguage Link in Module Details
- click View Details
- now you have a link to the help file
For security reasons, do not forget to delete both patch directories after you patched the installation!
-
Hi FrankH,
what is the difference between 0.3.0 and 0.4.0 ?
-
what is the difference between 0.3.0 and 0.4.0 ?
- 0.4 comes not only with 3 patch files for WB 2.7, but also with 5 patch files for WB 2.8
- HowTo is now html instead of txt
-
nice nice, I really like this module.
Also on thi thread: https://forum.WebsiteBaker.org/index.php/topic,14555.0.html you can find how to adapt your search funcion.
cheers
-
due to my poor skill on php, html, ecc.
where i can put "<?php easymultilang_menu(); ?>"?
in index.php
in *.css?
thanks
-
in <div><?php easymultilang_menu(); ?> </div> of index.php file where you want multilanguage menu to appear..
cheers
-
thanks!
-
Hi Frank,
Is there a way to define order of flags ?
For example in my menu tree I have me, en, ru languages
In snippet flag order is en, me , ru ... And If I change defult frontend language in settings, it doesnt change the order.... I would like to set me flag first..
is it possible ?
cheers
-
Hi Ivan,
you would need to make some code changes.
But would it be a good idea?
Usually users expect the same link to stay on the same position. It would annoy most people when they have to start searching a link after it changed its position, I think.
-
Hi Frank,
Please see the image attached. I noticed I ask few questions in same sentence :) So I'll split them:
1. I have menu tree like this:
ME
- ME page 1
- ME page 2
- ...
EN
- EN page 1
- EN page 2
- ..
RU
- RU page 1
- RU page 2
- ...
I understand that it is a little non usual, but is it possible, if you would do any further development for this module, that flags (like on my screenshoot ) use order from menu tree ?
2. My defult language in backend is set to ME, so I would like first flag to be ME, and not EN (like on my screenshoot ) , is it possible ? Does the snippet use alphabet order to set order for flags ?
all best,
I.
[gelöscht durch Administrator]
-
Hi,
I am trying to add the multilanguage to my site. I have installed the multilanguage module. I have added the code to display the multilanguage icons to the index.php page.
My site have 4 pages in english. Now do I need to create another four pages for spanish? I am not getting a clear idea about how I need to set it. Could you please provide a basic documentation by which a user who is not so much familiar with website baker and multilanguage can get a better idea to use it.
Thanking you..
-
Hi,
First - Just dont forget to install the patch files..
No, as it is mentioned in first post, you do not need to have same pages on different languages.
For example:
EN ES
Home <home> Home es
Page 1 <page1> Pagina 1
Page 2 <seccond> Paggina 2
Page 3
In <> is page code which needs to be inpuded in page settings. In this example, you see that Page 3 has no match page on spanish. When you click on flag image while you are on that page, you will be redirected to page where you set "home" page code.
Cheers
-
I understand that it is a little non usual, but is it possible, if you would do any further development for this module, that flags (like on my screenshoot ) use order from menu tree ?
2. My defult language in backend is set to ME, so I would like first flag to be ME, and not EN (like on my screenshoot ) , is it possible ? Does the snippet use alphabet order to set order for flags ?
Hi Ivan,
Sure it is possible, but needs some work, I assume. Currently I am finnishing the mpform help project with 40 pages of documentation, afterwards there is already another large task, so I won't have time during the next months for this snippet.
Regarding the last question: I think currently we have an unsorted list, but better look into the source code.
-
sorry, but where do you mean that we should copy the files to:
from /modules/easymultilang/patch2.8.0
to the directory with the same name under your WB path ??
i don´t know where you mean, when you say:
to the directory with the same name under your WB path ??
?
i have installed it, and now all the pages show up, both english and swedish? but i gues thats because im not finished with this moving/deleting files! :)
-
Before writing, you should have took a look into the directory /modules/easymultilang/patch2.8.0
May be this directory contains subdirectories with names, which are already there under your WB installation?
So what is your problem?
-
Nice module.. thx
Have installed it as instructed, (tested with 2 languages EN + DE)
Now.. Only English flag shows up with text "English", not clickable at all.
Any thoughts?
Note: I have made the structure of the website with default multilanguage functionality of WB
Version 2.8.1
Revision 1287
-
Maybe all your pages are on english, check page language on page settings. Also check fill in page code , for example:
startsite => fill in "home"
start => also fill in "home"
if it doesnt work, you can send me a link to your site so I can take a look
-
Is it possible to make this menu do clever things like showmenu2 can, i mean fi:
- start at x steps down the root
- only show up till x levels
- automaticallcy add à character to THE menu title. ( > [MENU_TITLE] )
Etc
-
This snippet doesnt to that. It can only transfer you to the page you select with another language.
I am not sure what are you trying to do. Can you describe on an example ?
-
thx crnogorac081,
of course.. i had all pages in English language. It works fine now.
Thx again.
-
thx crnogorac081,
of course.. i had all pages in English language. It works fine now.
Thx again.
Note that you can set page code = home for default page when no page on different language is selected via page code.
-
Yes, did define "home" as default page to show up when no similar page exists.
So i have to asign each page with a unique "Page Code" , same in each language. Right?
That's what i did... and works like a charm.
By the way: what is the languages definition in admin good for by default? Does it handle the encoding?
-
not sure, never tested that, so I use standard letters :)
-
Has anyone manage to change the code of flags order? It would be helpful to order according to backend language tree instead of alphabetical order, like it is now.
-
For anybody with this problem (ordering the language menu - flags, text, whatever you chose), I've solved it by, in the file "modules/easymultilang/include.php", replacing the line that orders the languages
ksort($langarr);
with this one (for my case):
$langarr = array('PT'=>$langarr['PT'], 'EN'=>$langarr['EN'], 'ES'=>$langarr['ES'], 'FR'=>$langarr['FR']);
you can change it with different languages or different order.
cheers
-
@aesteves
thx for the hint!
-
I Have a menu:
EN ES
Home Home es
Page 1 Pagina 1
Page 2 Paggina 2
Page 3
When I click to ES, open Page2 not home
-
Hi,
go to Pages -> Settings for ES and set page code same as for Page2
cheers
-
Thanks!
I don't know what you want say about "set page code"
-
Go to ES page -> go to settings, then in the list where title, description, language etc.. is , there is a Page Code input field. Type same word on ES and Page 2 and it will work..
-
I don't have "Page Code"
[gelöscht durch Administrator]
-
try this snippet. This snippet is the same that runs on WebsiteBaker homepage. I hope somebody helps me to write a tutorial in German and English.
Call in Template is
<?php if(function_exists('language_menu')){ language_menu('png'); } ?>
Dietmar
[gelöscht durch Administrator]
-
Hi,
if you see Snippets' page at AMASP: http://www.websitebakers.com/pages/code-snippets/various/easy-multilanguage-link.php
You have marked red: Requires: Requires patch in some kernel files for additional column page_code in the pages table, see HowTo.txt
There are some files (from the patch2.8.0 folder in zipped snippet) which needs to be replaced with core files..
cheers
-
Requires patch in some kernel files for additional column page_code in the pages table,
And all is gone by next Release.
Dietmar
-
Hi
I have used the WebsiteBaker Multilingual Switcher 1.6.5 and it works perfect.
http://www.WebsiteBaker.org/forum/index.php/topic,14037.msg157022.html#msg157022
I have made the language assignment manually. But the snippet also provides a link called "Pagecode" (only existing if the snippet has been installed).
Goto: Pages > Page settings > Link "Pagecode"
After klicking the link, the previously done assignment is gone. I do not think this is the originally intended functionality. Does anybody know what this link is intended to do?
Thanks and regards
Christoph
-
I have used the WebsiteBaker Multilingual Switcher 1.6.5
After klicking the link, the previously done assignment is gone. I do not think this is the originally intended functionality. Does anybody know what this link is intended to do?
if you install the module on a working system (maybe with 20 pages), the install progress update the new database field "page-code" with the page-ID from every page
But if you add a new page, the system set a 0 (zero) to this database field, you have to go to the page settings and select a target page from the main language tree
when you start a project with a installed multi lingual module from the begin and add all your pages, every page has the page code "0", but the script doenst work with a target page-id == 0, it needs the real page-id from the target page or the page-ID from this page self
The Link "page-code" set all this page-code's from zero to the page-id from every page, so that multi lingual can work without problems
but.... its also a RESET - all previously settings are gone without warning!
its helpfull, if you need a fast solution for a bigger system with many pages and sometime the Reset is a good solution, but not everytime..
in the next module version in wb 2.8.4 this link will only set the page-code-fields with a 0 and dont touch my settings there
-
Hi Chris,
here is what pagecode is for:
Hi,
First - Just dont forget to install the patch files..
No, as it is mentioned in first post, you do not need to have same pages on different languages.
For example:
EN ES
Home <home> Home es
Page 1 <page1> Pagina 1
Page 2 <seccond> Paggina 2
Page 3
In <> is page code which needs to be inpuded in page settings. In this example, you see that Page 3 has no match page on spanish. When you click on flag image while you are on that page, you will be redirected to page where you set "home" page code.
Cheers
I used Easy Multilanguage Link Snippet, and not Multilingual Switcher so I dont know why pagecodes resets.
I had no problems with Easy Multilanguage Link Snippet, it works perfectly so far.