Graham,
I have an idea or two below...
>
> -----Original Message-----
> From: Dan Bolser <dan.bolser@...>
> To: graham <graham@...>
> Cc: Alexander Gesinn <gesinn@...>,
> semediawiki-user@...
> Subject: Re: [Semediawiki-user] properties with multiple values
> Date: Thu, 21 Apr 2011 12:20:55 +0100
>
> On 19 April 2011 10:02, graham <graham@...> wrote:
> > Thanks Alexander/Dan
> >
> > Dan was right about the page links; I'd declared the property as
> type
> > string, not type page. My bad.
> >
> > The nowiki trick works fine for the pipes; now I'm using:
> >
> > {{#arraymap:{{{IsRelevantTo|}}}|,|x|[[Resource is relevant to::x|x]]
> > |<nowiki> | </nowiki>}}
> >
> > This gives me:
> >
> > E-journals | Psychology | Geography | Earth Sciences,,,,
>
> That's weird... but it rings a bell... Can't think what could be
> causing this tbh. Can you show us the exact 'IsRelevantTo' string that
> you're passing to the template and/or a link to an example of this
> problem?
>
In my experience, {{#arraymap}} leaves trailing commas if you use it to
set properties using the typical [[property::value]] statement. I have
found that if you use the {{#set:}} function to assign properties, this
is generally not a problem. In this case, you may want to try something
like this:
{{#arraymap:{{{IsRelevantTo|}}}|,|x|{{#set:Resource is relevant
to=x}}[[x]]|<nowiki> | </nowiki>}}
>
> > As you can see I still haven't managed to eliminate the trailing
> commas.
> >
> > I can't find an arrayprint function - did you mean the arraymap
> function
> > in SF_ParserFunctions.php? If so, it's not helping :-(
>
You can install ArrayExtension to get the #arrayprint function; it's a
bit trickier in some cases, but it can give you a bit more flexibility
when working with arrays. In this case, though, I think #set coupled
with links might work (if not, then you can probably do it with an
#arrayprint - the documentation is pretty good on that extension)
Hope this helps,
Alex
> >
> > Graham
> >
> >
> > On 04/19/11 07:35, Alexander Gesinn wrote:
> >> Hi Graham,
> >>
> >> try to use arraymap like this:
> >>
> >> {{#arraymap:{{{IsRelevantTo|}}}|,|x|[[Resource is relevant to::x|]]
> >> |<nowiki> </nowiki>}}
> >>
> >> For the output take a look at the #arrayprint parser function.
> >>
> >> /Alex
> >>
> >>
> >>
> >> Am 18.04.2011 21:47, schrieb Graham Seaman:
> >>> So now I need to display properties with multiple values, but I'm
> having
> >>> problems with them.
> >>>
> >>> I have the template line:
> >>>
> >>> {{#arraymap:{{{IsRelevantTo|}}}|,|x|[[Resource is relevant
> to::x]]}}
> >>>
> >>> where IsRelevantTo is set to a comma separated list in a form.
> >>>
> >>> The line above displays as (for example):
> >>>
> >>> Psychology, Geography, Earth Sciences,,,
> >>>
> >>>
> >>> What I would actually like to display is:
> >>>
> >>> Psychology | Geography | Earth Sciences
> >>>
> >>> where each of the subject names is a link to the subject page, the
> >>> separators are pipe symbols, and there are no trailing commas. I
> can't
> >>> persuade it to do this; can anyone tell me how?
> >>>
> >>> Thanks
> >>> Graham
> >>>
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>>
> >>> Benefiting from Server Virtualization: Beyond Initial Workload
> >>> Consolidation -- Increasing the use of server virtualization is a
> top
> >>> priority.Virtualization can reduce costs, simplify management, and
> >>> improve
> >>> application availability and disaster protection. Learn more about
> >>> boosting
> >>> the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> >>> _______________________________________________
> >>> Semediawiki-user mailing list
> >>> Semediawiki-user@...
> >>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>>
> >>
> >
> >
> >
> ------------------------------------------------------------------------------
> > Benefiting from Server Virtualization: Beyond Initial Workload
> > Consolidation -- Increasing the use of server virtualization is a
> top
> > priority.Virtualization can reduce costs, simplify management, and
> improve
> > application availability and disaster protection. Learn more about
> boosting
> > the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> > _______________________________________________
> > Semediawiki-user mailing list
> > Semediawiki-user@...
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and
> improve
> application availability and disaster protection. Learn more about
> boosting
> the value of server virtualization.
> http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Semediawiki-user mailing list
> Semediawiki-user@...
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
--
--
ontolawgy™: connect . . . the . . . dots™
http://ontolawgy.com
|