gerdamigerdami 14 Nov 2008 20:07

Last night, I had a dream.

That's true.

I have dreamed about improving the handbook.wikidot.com by using the live templates, instead of using [[include]]. The dream could come to reality if the wikidot developer team could provide me with the missing puzzle piece.

Back to last year

Last year, helmuti_pdorf does not match any existing user name, hartnellhartnell, Phil ChettPhil Chett and I, started the handbook.wikidot.com, the first multilingual wikidot website, at least as regards the content.
The trick, I called the Magic Language Navigation, was based on includes. Each page had to include the following:

[[include inc:languages pagename=NewPageNameHerePlease]]
----

while the content of include:languages was

[[=]]
[[[de:{$pagename}|Deutsch]]], [[[en:{$pagename}|English]]], [[[es:{$pagename}|Español]]], [[[fr:{$pagename}|Français]]], [[[pl:{$pagename}|Polish]]]
[[/=]]

Unfortunately, the user had to patch the word NewPageNameHerePlease by the current name of the page, with the convention that the page name would be in English for all languages (fr:start, en:start, de:start, it:start, …)

When previewing the page with the Page module, the words "Deutsch - Chinese - English - Español - Français - Italiano - Japanese - Nederlands - Polski - Português - Türkçe" were displayed. I once wrote this post ((hide)) Mister Hyde /((hide)) but without acknowledge.

Now with the live templates

The advantage with the live templates is that elements other that %%content%% are not displayed with the [[ListPages]] module. Hence the request for hiding something is less urgent.

In action !!!

Have a look at page en:test whose live template is en:_template1with the following content:

[[div style="float:right; width: 80px; border: 1px solid #999; margin: 0px; text-align:center"]]
Page also available in
[[include inc:languages pagename=%%page_unix_name%%]]
[[/div]]
%%content%%

… while the include:languages page contains:

[[[de:{$pagename}|Deutsch]]] [[[en:{$pagename}|English]]] [[[fr:{$pagename}|Français]]]

… flag version
[[table]]
[[row]]
[[cell]] [[[de:{$pagename}|de]]] [[/cell]]
[[cell]] [[image /include:languages/de.gif link="de:{$pagename}"]] [[/cell]]
[[/row]]
[[row]]
[[cell]] [[[en:{$pagename}|en]]] [[/cell]]
[[cell]] [[image /include:languages/en.gif link="en:{$pagename}"]] [[/cell]]
[[/row]]
[[row]]
[[cell]] [[[fr:{$pagename}|fr]]] [[/cell]]
[[cell]] [[image /include:languages/fr.gif link="fr:{$pagename}"]]
[[/cell]]
[[/row]]
[[/table]]

The variable $pagename is replaced at display time by the %%page_unix_name%% of the current page.

If you look at page fr:test and hover the mouse over the language links to the right, you will see:

de:fr:test
en:fr:test
fr:fr:test

Failed ! but close to the goal.

Why ? Because the %%page_unix_name%% also returns the category of the current page, fr:.

Conclusion - the missing puzzle piece is was …

the right part of the pagename.

That's incredible. Never seen in the world of software companies:
A request during the WE, fulfilled on Monday !

Thanks

Author

gerdamigerdami. Please visit his/her userPage.


Recommend this post?

rating: 0+x

What do you think? Give us your thoughts!

Add a New Comment