[pmwiki-users] Pagelists and multiple (:description:) tags

Olaf Marzocchi 550242083288-0001 at t-online.de
Sun Mar 1 12:13:58 CST 2009


In article <1154576358.20090301103358 at softflow.co.uk>,
 Hans <design5 at softflow.co.uk> wrote:

> Saturday, February 28, 2009, 9:56:41 PM, Olaf Marzocchi wrote:
> 
> > Hi everyone,
> > I am using pmwiki since 2.1 as CMS, more or less, but only now I started
> > trying to use custom templates for pagelists: I don't want to update 
> > manually the page indexes anymore...
> > I am using currently the "multiplanguage" recipe to allow the writing in
> > the same page of different versions of the text, of the keywords and of
> > the page description, then chosen automatically depending on the browser
> > language.
> > It works beautifully, but I found a problem with pagelists. I use the 
> > following custom template:
> 
> > [[#titlesummary]]
> > [[{=$FullName} | {=$Titlespaced}]]
> ->> {=$Description} ({=$LastModified})
> 
> > [[#titlesummaryend]]
> 
> > and I always get all the (:description:) fields of each page! For 
> > example, I get
> 
> > Immagini di lampadine
> > Bilder von zwei Glühlampen
> > Immagini di due diverse lampadine Pictures of two different light bulbs
> > (28/02/2009 ore 21:15 CET)
> 
> > The title ("Immagini lampadine") is correctly chosen depending on the 
> > current language, but not the description field and not the language of
> > the "last modified" field. The latter is, however, not important, I care
> > about the description fields.
> 
> How does your page switch the view to a particular language?
> Do you use a cookie setting for this, perhaps a page variable is set
> by a cookie? How are the different description tags made individual?

The page is served in the language defined by the browser, then a cookie 
is stored if the user chooses another language (or so it should be, 
given the recipe currently used). Pages with different languages are 
served with the
?userlang=CODE
appendix to the url.

> For instanc ei have been using the Viewmodes recipe for language
> switching: http://www.pmwiki.org/wiki/Cookbook/ViewModes
>
> This gives me apart from a (:if view :) conditional also a {$View} page
> variable. So with views defined to values of de, en, it, fr for
> instance, {$View}  will be rendered as one of those little strings,
> and i can use it to define a language (view) specific title or
> description or whatever page text variable.
> 
> For setting the title I used:
> 
> (:title {$:title{$View}} :)
> 
> and then set language specific titles with PTVs:
> 
> (:titlede: Ein Deutscher Titel:)
> 
> (:titleen: An English Title:)
> 
> etc.
> 
> Same goes for (:description {$:description{$View}} :)
> 
> Then your pagelist template can stay as you got it, since
>  {=$Description} will be rendered as the value from PTV
> {$:description{$View}},
> or you could use  {=$:description{$View}} directly in the template.
> 
> Hope this helps a bit!

It may be the solution, thanks!
I will try it.

Olaf




More information about the pmwiki-users mailing list