Nikos Papandreou
  • Home
  • Profile
  • Programming
    • Anonymous Outlook
    • Autorun Generator
    • Compiler
  • Blog

HOWTO: GetSimple CMS I18N Plugin + Fancy URLs + Lighttpd + Multilingual

14/10/2013

0 Comments

 
I installed I18N plugin v2.5.6 on a clean installation of GetSimple 3.0 on top of lighttpd. I enabled mod_rewrite and enabled the 10-getsimple.conf.

Instructions

For a language selector on top of every page

OPEN theme/theme-name/header.php
ADD inside wrapper div
                <!-- language selection -->
                <nav id="lang-nav" >
                    <ul>
                    <?php foreach(return_i18n_available_languages() as $i => $lang){
                        echo '<li'.(($lang == $_GET['lang']) ? ' ' : '').'>'
                            ."\t".'<a href="'.htmlspecialchars(return_i18n_setlang_url($lang)).'">'.$lang.'</a>'
                            .'</li>';
                    }?>
                    </ul>
                </nav>

To fix Home link of breadcrumbs

FIND
REPLACE WITH
                <a href="<?php get_site_url(); ?>">Home</a> &nbsp;&nbsp;&#149;&nbsp;&nbsp; <?php Innovation_Parent_Link(get_parent(FALSE)); ?> <b><?php get_page_clean_title(); ?></b>
                <?php
                    // Fetch menu title for index page
                    $tmp = return_i18n_menu_data('index');
                    $tmp = $tmp[0]['menu'];
                    echo '<a href="'.find_i18n_url('index').'">'.$tmp.'</a>';

                    //Fetch rest breadcrumbs
                    get_i18n_breadcrumbs(return_page_slug());
                ?>

Enabling Fancy URL at server level

Enable "mod_rewrite" in lighttpd.conf and enable the usage of the following conf.

10-getsimple.conf

$HTTP["host"] =~ "(^|www\.)example\.com$" {

    # Deny access to the backups, data and plugins directories...
    $HTTP["url"] =~ "^/gs/(backups|data|plugins)/" {
        # ...except the uploads, thumbs and every css, js, or images directory inside plugins
        $HTTP["url"] !~ "^/gs/(data/(uploads|thumbs)|plugins/(.*?/)(css|js|images))/?" {
            url.access-deny = ("")
        }
    }

    # Disable directory listing
    $HTTP["url"] =~ "^/gs($|/)" {
        dir-listing.activate = "disable"
    }


    # Use mod_rewrite for fancy URLS
    url.rewrite-if-not-file = (
        "^/gs/(en|gr)/(.*?/)?([A-Za-z0-9_-]+)/?$" => "/gs/index.php?id=$3&lang=$1",
        "^/gs/(en|gr)/?$" => "/gs/index.php?lang=$1",
    )


    $HTTP["url"] =~ "^/gs/?$" {
        url.redirect = (
            # Optional
            "/" => "http://www.example.com/gs/en/"
        )
    }
}
  1. If your GetSimple installation directory is / instead of /gs/ that I used in this example, simply search and replace all instances of /gs (without trailing slash and quotes).
  2. In this example I have only used, two languages, English and Greek. You can add as many as you want, as long as you make the appropriate changes to 10-getsimple.conf or if you replaced (en|gr)  with ([a-z]{2}).
0 Comments



Leave a Reply.

    Categories

    All
    Bitbucket
    Forefront
    Mercurial
    Php
    Sqlite
    Ssh
    Windows

    Archives

    October 2015
    November 2014
    March 2014
    October 2013

    RSS Feed