WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Snippet: Easy Multilanguage Link
  • Print
Pages: [1] 2 3   Go Down

Author Topic: Snippet: Easy Multilanguage Link  (Read 58715 times)

susigross

  • Guest
Snippet: Easy Multilanguage Link
« 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:

Code: [Select]
<?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
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #1 on: July 03, 2009, 02:52:16 AM »
I dont want to double the post..

https://forum.WebsiteBaker.org/index.php/topic,14312.msg89357.html#msg89357

Great job man !!!

Cheers
Logged
Web developer

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #2 on: July 15, 2009, 06:50:59 PM »
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

Logged
Web developer

susigross

  • Guest
Re: Snippet: Easy Multilanguage Link
« Reply #3 on: July 15, 2009, 08:04:18 PM »
Quote from: crnogorac081 on July 15, 2009, 06:50:59 PM
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.

Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #4 on: July 15, 2009, 09:34:49 PM »
Please check this link, I put MY in search box:

Code: [Select]
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:

Code: [Select]
<!-- 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 :)
Logged
Web developer

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #5 on: July 15, 2009, 09:41:08 PM »
did you modified anything more in the search page or something ?
Logged
Web developer

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #6 on: July 16, 2009, 05:51:26 PM »
I tried to include this into search/index.php page but no luck, the language are still gone...

Code: [Select]
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 ?
« Last Edit: July 16, 2009, 05:59:14 PM by crnogorac081 »
Logged
Web developer

susigross

  • Guest
Re: Snippet: Easy Multilanguage Link
« Reply #7 on: July 16, 2009, 08:08:03 PM »
Quote from: crnogorac081 on July 15, 2009, 09:34:49 PM
Please check this link, I put MY in search box:

Code: [Select]
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.

Quote
Can you guide me how to keep the flags dissapearing

???

Quote
did you modified anything more in the search page or something ?

No, why should I?
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #8 on: July 16, 2009, 08:38:24 PM »
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
« Last Edit: July 16, 2009, 10:23:28 PM by crnogorac081 »
Logged
Web developer

susigross

  • Guest
Re: Snippet: Easy Multilanguage Link
« Reply #9 on: July 17, 2009, 11:45:34 AM »
Quote from: crnogorac081 on July 16, 2009, 08:38:24 PM

Also, sometimes I get:   {l_loop}   text, which is also in the source..


Is this reproducable? How?
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #10 on: July 17, 2009, 03:18:10 PM »
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:
Code: [Select]
EN
- Page 1
- Page 2
-- Sub page 1
DE
- Page 1
- Page 2
-- Subpage 1

CASE 2, With this module:
Code: [Select]
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

« Last Edit: July 17, 2009, 04:19:12 PM by crnogorac081 »
Logged
Web developer

susigross

  • Guest
Re: Snippet: Easy Multilanguage Link
« Reply #11 on: July 17, 2009, 05:38:27 PM »
Quote from: crnogorac081 on July 17, 2009, 03:18:10 PM
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.

Quote
Also, I think that this module should me integrated into WB 2.8..

Say this to the developers...
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #12 on: July 18, 2009, 02:39:13 AM »
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 :)
Logged
Web developer

Offline BerndJM

  • Posts: 1764
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #13 on: July 18, 2009, 03:49:47 AM »
@crnogorac081:

Quote
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
« Last Edit: July 18, 2009, 03:53:11 AM by BerndJM »
Logged
In theory, there is no difference between theory and practice. But, in practice, there is.

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #14 on: July 18, 2009, 01:25:05 PM »
ok, Im just sayin this is better way to create multilanguage sites :))

Anyway, I'll post the ticket :)
Logged
Web developer

susigross

  • Guest
Snippet: Easy Multilanguage Link v 0.4
« Reply #15 on: July 18, 2009, 02:38:45 PM »
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!
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #16 on: July 18, 2009, 03:29:53 PM »
Hi FrankH,

what is the difference between 0.3.0 and 0.4.0 ?
Logged
Web developer

susigross

  • Guest
Re: Snippet: Easy Multilanguage Link
« Reply #17 on: July 18, 2009, 03:33:21 PM »
Quote from: crnogorac081 on July 18, 2009, 03:29:53 PM
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
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #18 on: July 19, 2009, 11:51:41 PM »
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

Logged
Web developer

Offline mava100

  • Posts: 38
Re: Snippet: Easy Multilanguage Link
« Reply #19 on: September 08, 2009, 04:46:34 PM »
due to my poor skill on php, html, ecc.
where i can put "<?php easymultilang_menu(); ?>"?

in index.php
in *.css?

thanks
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #20 on: September 08, 2009, 05:23:16 PM »
in <div><?php easymultilang_menu(); ?> </div> of index.php file where you want multilanguage menu to appear..

cheers
Logged
Web developer

Offline mava100

  • Posts: 38
Re: Snippet: Easy Multilanguage Link
« Reply #21 on: September 08, 2009, 05:34:44 PM »
thanks!
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #22 on: November 09, 2009, 07:01:18 PM »
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
Logged
Web developer

susigross

  • Guest
Re: Snippet: Easy Multilanguage Link
« Reply #23 on: November 09, 2009, 07:33:38 PM »
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.
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: Snippet: Easy Multilanguage Link
« Reply #24 on: November 09, 2009, 08:53:07 PM »
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]
Logged
Web developer

  • Print
Pages: [1] 2 3   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Snippet: Easy Multilanguage Link
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2