Page 1 of 1

Multiple versions via little php-script

Posted: Fri 2. Jun 2006, 10:22
by jojostg
Hi,

maybe it's interesting for some people.

Yesterday, I played with the great multiple-language-script of pepe (http://www.phpwcms.de/forum/viewtopic.p ... sc&start=0) and made minor changings.

Now you can also use a suffix instead of prefix and cut it after "_"

Script is:

Code: Select all

<?PHP
// copyright by Manfred Peperkorn :: strip-prefix.php
// changings by Juergen Kraemer to :: version-change.php
// find alias-name - turn alias-name
// strip prefix (actually suffix) - turn alias-name again 
// give back name 
//    alias:    aliasname-example_v1
//    strip:    v1
//    give back: aliasname-example_

$alias = $GLOBALS['content']['struct'][($GLOBALS['aktion'][0])]['acat_alias'];
$u = strrev($alias);
$search = "_";
$aliasNOsuffix = stristr($u,$search);
$t = strrev($aliasNOsuffix);
echo $t;
?>
- save script for instance as version-change.php in /phpwcms_template/inc_script/
- use in phpwcms links like : <a href="index.php?{PHP:phpwcms_template/inc_script/version-change.php}v2" target="_self">Version 2</a>

- you have to use alias-names in phpwcms like "contact_v1" "contact_v2" ...

So, if you want to you can have a combination of a multiple-language and multiple-version site. It works here http://www.medikanto.de for switching between two languages and my different designs.

Regards

jojostg

Posted: Sat 3. Jun 2006, 01:35
by culda_a
hi jojostg is great but realy what is new to thi script? it will be great to do one that give you the posibility to switch between 3 or 4 languages.

just a sugestion

Posted: Sat 3. Jun 2006, 02:16
by pepe
Hi culda_a,


there is no limit of the used languages... take 5 and it will work fine :idea:

Posted: Sat 3. Jun 2006, 11:38
by culda_a
Hi pepe, thanks for notification, I did not know that I have belive that your script works for 2 languages only ...my mistake :wink: