Oh jes, get-simple is really very limited in this way, but if you neet a few static pages like in this website and simple structure I find this system useful.
Of course, I can give you code.
call this in your theme file to return menu:
Code:
<?php get_navigation_lang_specific(return_page_slug()); ?>
add this to functions.php:
Code:
<?php
function get_navigation_lang_specific($currentpage) {
global $PRETTYURLS;
global $SITEURL;
$menu = '';
$path = GSDATAPAGESPATH;
$dir_handle = @opendir($path) or die("Unable to open $path");
$filenames = array();
while ($filename = readdir($dir_handle)) {
$filenames[] = $filename;
}
$count="0";
$pagesArray = array();
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if ($file == "." || $file == ".." || is_dir(GSDATAPAGESPATH . $file) || $file == ".htaccess" ) {
// not a page data file
} else {
$data = getXML(GSDATAPAGESPATH . $file);
if ($data->private != 'Y') {
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$pagesArray[$count]['menuOrder'] = $data->menuOrder;
$pagesArray[$count]['menu'] = stripslashes(htmlspecialchars_decode($data->menu, ENT_QUOTES));
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['title'] = stripslashes(htmlspecialchars_decode($data->title, ENT_QUOTES));
$pagesArray[$count]['parent'] = $data->parent;
$count++;
}
}
}
}
$pagesSorted = subval_sort($pagesArray,'menuOrder');
if (count($pagesSorted) != 0) {
global $sorted_nr;
foreach ($pagesSorted as $page) {
$sel = ''; $classes = '';
$url_nav = $page['url'];
$language = return_parent();
$links_slug=current_slug($url_nav);
$page_slug=return_page_slug();
if($page_slug==$links_slug) { $style="class=\"aktyvi-nuoroda\""; } else { $style=""; }
if(($links_slug=="teisininkai" && $page_slug=="kristupas-kerutis") || ($links_slug=="lawyers" && $page_slug=="assistant-kristupas-kerutis") || ($links_slug=="2" && $page_slug=="2-kristupas-kerutis") || ($links_slug=="rechtsanwalte" && $page_slug=="assistenz-kristupas-kerutis") || ($links_slug=="prawnikow" && $page_slug=="asystent-kristupas-kerutis")) { $style="class=\"aktyvi-nuoroda\""; }
if($language=='en') { $kalbos='en'; $contacts='Contacts'; }
else if($language=='lt') { $kalbos='lt'; $contacts='Kontaktai'; }
else if($language=='ru') { $kalbos='ru'; $contacts='áòÑÂ÷ø'; }
else if($language=='de') { $kalbos='de'; $contacts='Kontakt'; }
else if($language=='po') { $kalbos='po'; $contacts='Kontakt'; }
if ($page['menuStatus'] == 'Y' && $page['parent']==$kalbos) {
if($page_slug=="parasykite-mums" || $page_slug=="contact-us" || $page_slug=="7" ||$page_slug=="kontaktieren-sie-uns" || $page_slug=="kontakt-z-nami" ) { $sorted_nr=5; }
if ("$currentpage" == "$url_nav") { $sorted_nr=$page['menuOrder'];
$classes = "current ". $url_nav; } else { $classes = $url_nav; }
if ($page['menu'] == '') { $page['menu'] = $page['title']; }
if ($page['title'] == '') { $page['title'] = $page['menu']; }
$menu .= '<li '.$style.'><a href="' . find_url($page['url'],$page['parent']).'">'.$page['menu'].'</a></li>';
}
}
}
closedir($dir_handle);
echo $menu;
}
function return_page_slug() {
global $url;
return $url;
}
?>
<?php
function current_slug($url){
$nr = 0;
$delims = "/";
$zodis = strtok($url,$delims);
while(is_string($zodis)){
if($zodis){
$masyvas[$nr]=$zodis;
}
$nr++;
$zodis = strtok($delims);
}
$nrx=$nr-1;
return $masyvas[$nrx];
}
function return_page_slug() {
global $url;
return $url;
}
?>
I think that's it... You should pay attention that in lawyers section there are some differences in page structure so i added some if's in code.
And sorry for nasty code -- i'm just learning... :-)
weblogic Wrote:Oh, I see. I thought you might be using custom fields as described in this thread:
http://get-simple.info/forum/post/3746/.
Your approach sounds smart to me as well, as long as you don't need "visible children" pages, because I believe GS only allows two levels and all your pages are already children of 'en', 'ru', etc.
Anyway, I am trying to figure out how to make a multilingual site for myself with GS, but I am not a coder, so I don't know how to proceed... Not sure if I am asking too much but, would you mind to share your code?
Thanks!