Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Multilingual blog

edited August 2013 in Apps

I created multilingual pages and blocks without problem...you can also create a multilingual blog. thanks

Comments

  • The blog is a single stream of posts, so it can't serve the same post in multiple languages, but separate posts can be in different languages.

    You can also override the built-in functionality with your own code to create a custom blog page. Here are the steps to do this:

    1. Copy apps/blog/handlers/index.php into a new file like apps/sitename/handlers/blogindex.php so you can edit it without having to change the original code.

    2. Edit the file apps/blog/conf/config.php and change the setting blog/index = blog/index to say blog/index = sitename/blogindex. This is in the [Custom Handlers] section.

    3. In your new blogindex.php, remove these lines:

    // Check for a custom handler override
    $res = $this->override ('blog/index');
    if ($res) { echo $res; return; }
    

    And change theses line:

    $posts = $p->latest ($page->limit, $page->offset);
    $page->count = $p->query ()->where ('published', 'yes')->count ();
    

    To this:

    $posts = $p->tagged ($i18n->language, $page->limit, $page->offset);
    $page->count = $p->count_by_tag ($i18n->language);
    

    Now the blog page should only show posts that have the current language code as a tag (e.g., fr or es).

    Let me know if that works!

  • That's great, I changed the path in blogindex.php : $post->url = '/blog/post/' . $post->id . '/' . URLify::filter ($post->title); to: $post->url = '/en/blog/post/' . $post->id . '/' . URLify::filter ($post->title); and works great! Thank you very much Johnny

  • Glad it worked! :)

  • Hi, I have a problem with the blog when I choose the English language, for example: English > Blog > Welcome post, I am redirected to the Italian language, you can solve this problem? My website: http://www.claudiobottero.com

    Thanks

  • Nice site. What did you use for the slider?

  • It looks like you need to make sure all the URLs in your modified blog handlers and views are using $i18n->language (or {{i18n.language}} in the views) as a URL prefix.

  • Ok solved I used i18n.language {{}} in views. Thanks

    @ twheel: for the parallax I used FlexSlider and Modernizer Download Builder.

  • Awesome! And that is a cool slider effect :)

Sign In or Register to comment.