Ok, just a quick update:
I’m still playing with this so let’s keep this as an idea based thread for a bit.
1,) add an extra column to the site_content column:
name of field: lang
type: char(2)
default: en
I went with letters since I was thinking that it would be easier to remember compared to what language is what number? was it 1,2 or 4
also, might be easier to pull from a domain list ... .jp, .ru, .us ... etc .. anyway, there aren’t going to be that many main languages are there?
here is a TV that I’ve been playing with on the multiflex1 type that I ported and posted here.
@EVAL
global $modx;
$id = $modx->documentIdentifier;
$tbl = $modx->dbConfig[' DB----NAME---GOES HERE! ']."modx_site_content";
$result = $modx->db->getValue("SELECT lang FROM ". $tbl ." WHERE id = " . $id);
$lang = $result;
If ( $lang == 'jp' ) {
$LanguageMenuSelector = '@CHUNK mfHeader_Japanese';
} elseIf ( $lang == 'en' ) {
$LanguageMenuSelector = '@CHUNK mfHeader_English';
} elseIf ( $lang == 'ru' ) {
$LanguageMenuSelector = '@CHUNK mfHeader_Russian';
} else {}
return $LanguageMenuSelector;
Pretty cool since my pages seem to be parsing a bit quicker than with the previous cookie call I was using, also, I don’t have any troubles with switching between languages and seeing the previously seleceted language menu -- this bit of problem is more than likely my sh_tty coding
As for working from the admin side.
Sorry folks but currently everything is being done from phpmyadmin.
However, I did duplicate a document and saw that the new document carried over the field "lang". I haven’t tried from a new document but I imagine that the result variable will just return "0" or something like that
I would like to be able to call this like the static variables like id, pagetitle and content but I’m still lost in the core code for modx at the moment. However, if this were added to the core then we’d be able to call the variable much easier and wouldn’t need to add the extra query to the page
Can somebody lead me in the right direction?
Cheers and have fun!