Weblog-Menus extension for Multi-Lingual Website support

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Weblog-Menus extension for Multi-Lingual Website support

Postby kabaal » Wed Jul 14, 2010 9:04 am

Hey there,

Get the extension:
weblog-menus.zip
(7.46 KiB) Downloaded 362 times


the general idea of this extension, inspired by Thorsten Schlueter's topnav extension, is

    * To define a weblog for each language
    * To have seperate chapters and pages per weblog/language
    * Thus having multi-linguality!

The extension displays all chapters and/or pages "beloinging to" the current weblog as an unsorted list.

In order to achieve this multi-linguality, the chapter names must be formated [weblogname][separatorchar][chaptername]. For example "en_home" would mean that the chapter is intended for weblog "en", the separator is "_" and the chaptername is "home". Chapters that do not match [weblogname][separatorchar][chaptername] are not displayed and only chapters/pages of the matching weblog are displayed for the current active weblog.

Let's say I have the following weblogs:
"en" for the english language
"nl" for the dutch language

and the following menu-structure:
en_home (chapter)
welcome (page)
contact us (page)
nl_home (chapter)
welkom (page)
contact opnemen (page)

The resulting list when the english weblog (?w=en)is active will look something like this:
Code: Select all
<ul>
    <li><a href="?p=welcome">home</a>
    <ul>
        <li><a href="?w=en&p=welcome">welcome</a></li>
        <li><a href="?w=en&p=contact-us">contact us</a></li>
    </ul>
    </li>
</ul>

and for the dutch weblog (?w=nl)
Code: Select all
<ul>
    <li><a href="?w=nl&p=welkom">home</a>
    <ul>
        <li><a href="?w=nl&p=welkom">Welkom</a></li>
        <li><a href="?w=nl&p=contact-opnemen">contact opnemen</a></li>
    </ul>
    </li>
</ul>


The tag for the extension is
Code: Select all
[[ weblog_menus type="all" separatorchar="_" ]]

you should use this in your templates to display the menu. If you put this code inside a div, you can make it look nice using CSS. If you wish I can post some examples on how to do this, I use a horizontal menu for the chapters, and when you hover over the chapter, a submenu with the pages is displayed.

The parameters:
type, "all" (default), "chapters", "pages"
- so you can decide to display a complete list with chapters + pages, just the chapters or just the pages (all pages of all chapters, without the chapters)

separatorchar, the separator in the chaptername, usually an underscore or something.

If you complement this with a "language selector" somewhere in your website, using something like
Code: Select all
[[weblog_list format="<a %active% href='%link%' title='%payoff%'>%payoff%</a><br>" current="class='active'" sort="payoff"]]

to display all the available weblogs as a "language" link. Use the weblog's "Payoff" as a descriptive name, E.g. "English" for the "en" weblog and you've got a nice little language selector that switches the weblog/language of your site.

I hope it comes in handy. I've looked all over the internet for a nice flatfile multi-lingual cms, and always there was somethnig missing. By adding in this extension, I personally have everything (well almost, but I've written some other extensions too :-) I need..

Regards,
JDT
Last edited by kabaal on Wed Jul 14, 2010 2:52 pm, edited 1 time in total.
JDT - Only trying to help...
kabaal
 
Posts: 25
Joined: Fri Jul 09, 2010 7:17 am
Location: Netherlands / Germany

Re: Weblog-Menus extension for Multi-Lingual Website support

Postby hansfn » Wed Jul 14, 2010 12:16 pm

Thx for the contribution - again. It seems really, really useful. (I haven't looked at the code, but from the other things you have written it's probably good.)

Could you please consider submitting your extensions to http://extensions.pivotx.net/? It's a little more hassle since you have to follow the guidelines, but I think you are pretty close already.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Weblog-Menus extension for Multi-Lingual Website support

Postby kabaal » Wed Jul 14, 2010 12:46 pm

Hi hansfn,

I thought I'd just submit it here and see if people actually want something like this, before submitting things "officially", but sure thing, I'll look into it shortly and see what I have to do to get it submitted properly :-).

Thanks again for your support!

JDT
JDT - Only trying to help...
kabaal
 
Posts: 25
Joined: Fri Jul 09, 2010 7:17 am
Location: Netherlands / Germany

Re: Weblog-Menus extension for Multi-Lingual Website support

Postby kabaal » Wed Jul 14, 2010 2:54 pm

FYI, I added the necessary documentation and sent the extension to the PivotX team.

I've updated the attachment in the first post, so that the documentation is complete in there as well.

Regards,
JDT
JDT - Only trying to help...
kabaal
 
Posts: 25
Joined: Fri Jul 09, 2010 7:17 am
Location: Netherlands / Germany

Re: Weblog-Menus extension for Multi-Lingual Website support

Postby hansfn » Thu Jul 15, 2010 10:02 am

PS! I have started a general thread about about Multi-Lingual Website support and PivotX. I have mentioned your extension as one of the recommended solutions ...
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway


Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 3 guests

cron