multilingual site while 1.30 -> 2.00 question

Discuss phpwcms here, please do not post support requests, bug reports, or feature requests! Non-phpwcms questions, discussion goes in General Chat!
Post Reply
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

multilingual site while 1.30 -> 2.00 question

Post by update »

Dear OliverG,
is there any plan for a multilingual addon in your pipeline for phpwcms? If so, what can I do until then to achieve an easy migration to such a solution while using any of the existing ways(hacks)
If not so, what would be the -best- recommendation for building a multilingual site?
Many thanks in advance!
claus
User avatar
Oliver Georgi
Site Admin
Posts: 9889
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

There is something like this planned later. Don't know when I will start with it. At first I will implement an additional language selection for articles and relation between same content.

But don't ask for details. There is nothing to discuss about at the moment.

I will not support any hack referring to this.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

Thank you for your clear response.
...don't ask for details...
No :wink:
So while patiently waiting (kind of) I will go ahead and try some of the exiting hacks...

Greeings
claus
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

Hi claus, there is no hack needful to solve your problem.
Please wait a moment I will write a little tut.

Regards Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

Hi Knut,

this is really good news and I'm appreciating your help really much!

greetings
claus
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

KH_Multilanguage / KH_Multidomain

Post by flip-flop »

V1.2.7 - 1.3.x
- Basics :Level and IDs
- Navigation
- Switch for different domains

Basics: Level and ID with a multilingual switch e.g. (IDs are coincidentally selected)
=====================================================

Code: Select all

 ------------------------------------
 L  E  V  E  L
-:  :  :  :  :
-0  1  2  3  4   <- LEVEL-No.)
-:  :  :  :  :
-+ home   :  :                        ID=0
-+--+ en                              ID=01
-+--+--+ en_category_01               ID=02
-+--+--+ en_category_02               ID=03
-+--+--+--+ en_category_02_01         ID=05
-+--+--+--+--+ en_category_02_01_01   ID=07
-+--+--+--+--+ en_category_02_01_02   ID=08
-+--+--+--+ en_category_02_02         ID=06
-+--+--+--+ en_category_02_03         ID=09
-+--+--+ en_category_03               ID=04
-+--+--+ en_category_04               ID=10
-:  :  :  :  :
-+--+ de                              ID=11
-+--+--+ de_Kategorie_01              ID=12
-+--+--+ de_Kategorie_02              ID=13
-+--+--+--+ de_Kategorie_02_01        ID=15
-+--+--+--+--+ de_Kategorie_02_01_01  ID=17
-+--+--+--+--+ de_Kategorie_02_01_02  ID=18
-+--+--+--+ de_Kategorie_02_03        ID=16
-+--+--+--+ de_Kategorie_02_03        ID=19
-+--+--+ de_Kategorie_03              ID=14
-+--+--+ de_Kategorie_04              ID=20

category
-:  :  :  :  :
-0  1  2  3  4   <- LEVEL No.
 ------------------------------------
----------
Level based: The level is relatively addressed.
We need this for a right navigation.

Every language has its own template.


NAVIGATION
=====================================================
A simple navigation at the right/left using the navigation tag {NAV_LIST_UL:F ........
- NAV_LIST_UL V1.3x
-----------------------------------------------------
en: {NAV_LIST_UL:F,01,,act_path,active,,,}
de: {NAV_LIST_UL:F,11,,act_path,active,,,}

Combination of an horizontal & vertical navigation
=====================================================
E.g. The horizontal output

Code: Select all

+---------------------------------------------------------------------+
| [en_category_01] [en_category_02] [en_category_03] [en_category_04] |
+---------------------------------------------------------------------+
en: <div class="nlu_horiz1">{NAV_LIST_UL:F,01,1,act_path,active}</div>
de: <div class="nlu_horiz1">{NAV_LIST_UL:F,11,1,act_path,active}</div>
(one level deep).

E.g. the vertical sub output for an active [en_category_02]

Code: Select all

+----------------------+
| [en_category_02_01]  |
| [en_category_02_02]  |
| [en_category_02_03]  |
+----------------------+
Please copy this snippet into every language template.
You can lift an ID based navigation to an level based navigation
I called it level lift. (Have a look too at the end of this posting - NAV_LIST_UL V1.3x).

Code: Select all

[PHP]
if(isset($GLOBALS['LEVEL_ID'][1])) {
  $level_id = $GLOBALS['LEVEL_ID'][1];
  echo '<div class="nlu_navi1">'.LF;
  echo '{NAV_LIST_UL:F,'.$level_id.',,act_path,active,,,}';
  echo '</div>';
  }
[/PHP]
Where LEVEL_ID'[X] is the level.


Switch for Different domains
=====================================================
http://www.phpwcms.de/forum/viewtopic.php?p=73725#73725
There is a switch working with two domains mydomain1.com and mydomain2.com generating an HTTP Status Code:
HTTP Status Code: HTTP/1.1 301 Moved Permanently

Important: Please use only this entry in config: $phpwcms['site'] = 'http://'.$_SERVER['SERVER_NAME'].'/';
$_SERVER['SERVER_NAME'] should always contain the current called Domain.
With LEVEL_ID[1] you always know the starting level ID for the menus.

Copy this snippet into the folder /include/inc_script/frontend_init/
config: $phpwcms['allow_ext_init'] = 1;

Code: Select all

<?php
// compare against current domain and redirect to correct if neccessary
// http://www.phpwcms.de/forum/viewtopic.php?p=73771
// Installation: Put this snippet into the folder /frontend_init/
// and switch at conf.inc.php: $phpwcms['allow_ext_init']    = 1;
// E.g.:
// Startpoint from mydomain1.com is the ID=01 -> $LEVEL_ID[1] = 1
// Startpoint from mydomain2.com is the ID=11 -> $LEVEL_ID[1] = 11
//
// PHPWCMS_URL -> http://mydomainX.com/
// returnGlobalGET_QueryString() -> ?alias
// $aktion[0] == 0 -> pointer at the root level


if(isset($LEVEL_ID[1])) {
   // Pointer behind the root level ?
   // Yes -> check active Domain behind root level
      if($LEVEL_ID[1] == 1 && strpos(PHPWCMS_URL, 'mydomain1.com') === false) {
      // E.g. Using the ID=1 (for maydomain1.com) but with the domain maydomain2.com, than switch back to .mydomain1.com
      // E.g. http://www.mydomain2.com/index.php?1-contact  switch to http://www..mydomain1.com/index.php?1-contact
         headerRedirect('http://www.mydomain1.com/index.php'.returnGlobalGET_QueryString());
      } else {
       // The same for the domain mydomain2.com
         if($LEVEL_ID[1] == 11 && strpos(PHPWCMS_URL, 'mydomain2.com') === false) {
            headerRedirect('http://www.mydomain2.com/index.php'.returnGlobalGET_QueryString());
            }
         }
} else {
   // check root level for active Domain
   if($aktion[0] == 0) {
   // pointer on the root level e.g. http://mydomain1.com/  ??
      if(strpos(PHPWCMS_URL, 'mydomain1.com')) {
      // Yes, go to my startpage for the domain 1
         header( "HTTP/1.1 301 Moved Permanently" );
         headerRedirect('http:/www.mydomain1.com/index.php?mydomain1_start');
      } elseif(strpos(PHPWCMS_URL, 'mydomain2.com')) {
         // The same for domain 2
         header( "HTTP/1.1 301 Moved Permanently" );
         headerRedirect('http://www.mydomain2.com/index.php?mydomain2_start');
         } else {
         //redirect to "default"  -> Fallback if there is an third domain or what ever
            header( "HTTP/1.1 301 Moved Permanently" );
            headerRedirect('http://www.default.com/index.php?default_start');
            }
      }
}
?>
Thats it, I hope it is working well for you.

Regards Knut :D
Last edited by flip-flop on Tue 22. Jan 2008, 13:12, edited 5 times in total.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

Dear Knut,

-mmany- thanks for this "little" TUT :idea:

Some questions for even more enlightenment though:

Am I getting it right: it doesn't matter which order of page / level generation I choose - I will be able to add pages / levels any time and any number later on while working with the site(s)?

I have to mirror all categories and pages exactly ?

And: While building the categories will it be good practice to alias them like en_my-name-for-this and de_mein-name-fuer-dies for being able to use rewrite? Or did you use the prepending de_ and en_ for clarification only?

Again: WOW - this will help me (and others too) stumbling forward through the jungle :D

greetings
claus
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

thanks flip flop for this listing!
(should be on faq.phpwcms-docu.de ?!) will bokkmark it :-)
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

@claus
Am I getting it right: it doesn't matter which order of page / level generation I choose - I will be able to add pages / levels any time and any number later on while working with the site(s)?
Yes
I have to mirror all categories and pages exactly ?
No. Only the point of entries e.g. ID01 for en & ID11 for de are important. After the first creation of this points they dont change any more (IDs).
And: While building the categories will it be good practice to alias them like en_my-name-for-this and de_mein-name-fuer-dies for being able to use rewrite?
It isn´t necessary to use de_/de- or en_/en-. But attention: We don´t may use double aliases.
Or did you use the prepending de_ and en_ for clarification only?
So it is.

@marcus@localhorst
should be on faq.phpwcms-docu.de ?!
Yes, you are right, but at this moment my login is lost at the FAQ. If there are some changes I can´t do it fast.
But by the time I will call pappnase.

Regards Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

Thank you very much!
claus :D
TI&OSM
Posts: 37
Joined: Tue 27. Feb 2007, 09:30
Location: The Hague, The Netherlands

Post by TI&OSM »

Thanks Knut for your tutorial…!

Robert [TI&OSM]
Nordlicht
Posts: 160
Joined: Wed 12. Apr 2006, 08:16
Location: Germany, near Hamburg
Contact:

Re: Multilanguage/Multidomain

Post by Nordlicht »

flip-flop wrote:V1.2.7 - 1.3.x
...

NAVIGATION
=====================================================
A simple navigation at the right/left using the navigation tag {NAV_LIST_UL:F ........
http://www.phpwcms.de/forum/viewtopic.php?t=12716
-----------------------------------------------------
en: {NAV_LIST_UL:F,01,,act_path,active,,,}
de: {NAV_LIST_UL:F,11,,act_path,active,,,}

Combination of an horizontal & vertical navigation
=====================================================
E.g. The horizontal output

Code: Select all

+---------------------------------------------------------------------+
| [en_category_01] [en_category_02] [en_category_03] [en_category_04] |
+---------------------------------------------------------------------+
en: <div class="nlu_horiz1">{NAV_LIST_UL:F,01,1,act_path,active}</div>
de: <div class="nlu_horiz1">{NAV_LIST_UL:F,11,1,act_path,active}</div>
(one level deep).

E.g. the vertical sub output for an active [en_category_02]

Code: Select all

+----------------------+
| [en_category_02_01]  |
| [en_category_02_02]  |
| [en_category_02_03]  |
+----------------------+
Regards Knut :D
Is it possible to give each main category and the vertical sub that belong to that an own color?
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

I think you can solve it using the id parameter.
It is nearly hardcodet but you can produce some structure levels in a hidden area for a futurity using. And the coresponding css classes too.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Post Reply