Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
www.advokataskerutis.lt - lawyer's website
#1
http://www.advokataskerutis.lt -- lawyer's based in Lithuania website. A lot of languages - as parents in link structure...

Thank you, get-simple!
http://www.8mind.lt -- web design and development
Reply
#2
Nice site apelsinas!

How did you manage to show only the relevant menus based on each language?
Reply
#3
Hi, thanks.

Relevant menus are shown using conditional statement which checks the parent page. So if, for example, the current parent page is 'en', it retrieves only children of 'en' and so on.

weblogic Wrote:Nice site apelsinas!

How did you manage to show only the relevant menus based on each language?
http://www.8mind.lt -- web design and development
Reply
#4
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!
Reply
#5
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!
http://www.8mind.lt -- web design and development
Reply
#6
Thank you apelsinas!

I'll take a close look at your code and try to make it suitable for my site. I wish I could consider myself a PHP beginner... I'm rather a PHP illiterate! Smile

GS is probably the best tool in the light CMS arena, no question. It's a real pity it does not support basic multilingual content capabilities in the core or as an "official" plugin. But I have faith... Smile
Reply
#7
I hope you will find out. If not - write me down - I might find some time to write a little plugin for multiple language support in get-simple.

good luck ;-)

weblogic Wrote:Thank you apelsinas!

I'll take a close look at your code and try to make it suitable for my site. I wish I could consider myself a PHP beginner... I'm rather a PHP illiterate! Smile

GS is probably the best tool in the light CMS arena, no question. It's a real pity it does not support basic multilingual content capabilities in the core or as an "official" plugin. But I have faith... Smile
http://www.8mind.lt -- web design and development
Reply
#8
hi i just insert your code to my theme, but is not working Sad
any help? thanks
Reply




Users browsing this thread: 1 Guest(s)