Problem with injected=true parameter and add-label macro
Hi,
i'm not sure if this is a bug.
This is what i'am trying:
adding a label for just one page works
{report-on:injected=true}
{add-label:%title%}
{report-on}
adding labels for multiple pages doesn't work (all pages have no spaces and no special chars)
{report-on:content:children|injected=true}
{add-label:%title%}
{report-on}
I can't figure out.
i'm not sure if this is a bug.
This is what i'am trying:
adding a label for just one page works
{report-on:injected=true}
{add-label:%title%}
{report-on}
adding labels for multiple pages doesn't work (all pages have no spaces and no special chars)
{report-on:content:children|injected=true}
{add-label:%title%}
{report-on}
I can't figure out.
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?Hi Christian,
I tried it out and replicated your results. It's not strictly a bug, although it would be nice if there was a workaround for the problem - I've needed to do something similar myself in a few cases.
Essentially, when you do a report-on, the content is executed in the context of the value you're currently reporting on, in this case the individual child pages. So, add-label is working - it's just adding the label to each child page, not the parent page as you were wanting.
{add-label} doesn't allow you to specify what context to execute the value in, so it gets a bit tricky at this point. Essentially, you will need either a user macro, or to wrap the whole thing in a {report-block} so you can execute the {add-label} in the context of the parent page.
The {report-block} option will look something like this:
{report-block}
{local-reporter:page:children}
{report-block:injected=true}{report-on:report:root content}{add-label:%page:title}{report-on}{report-block}
{report-block}
1 person says
this answers the question
-
Inappropriate?Hi,
i've written a user macro.
## works with 2.9 and 2.10
#if($param0)
#set ($param0 = $param0.replaceAll('\s*,\s*', ','))
#set ($labelstr = $param0.replaceAll('\s', ','))
#set( $labels= $labelstr.split(",") )
#set($count = 0)
#foreach( $i in $labels)
#set($success = ${content.labelUtil.addLabel($i,$action.labelManager,$content)})
#set( $count = $count + 1 )
#end
#end
It has the same problems with the context but you can use the RnR workaround (addlabels is my usermacro here)
{replace-and-render}
{replace-item:%VALUE%}{report-on:content:children|Source=Home|injected=true}
\{addlabels:%title%\}
{report-on}{replace-item}
{replace-body}
%VALUE%
{replace-body}
{replace-and-render}
have to investigate -
Inappropriate?btw. your idea also works great
{report-block}
{local-reporter:content:children|Source=Home}
{local-reporter}
{report-body:injected=true}{report-on:report:root content}{add-label:%content:title%}{report-on}{report-body}
{report-block}
Would be nice to have a second report-on or maybe a parameter which sets the context to have a shorter markup
thx for help -
Inappropriate?Yeah, I really need to add some more report-on aliases. Had a similar problem myself earlier last week.
Some way to specify the execution context is a possibility, but introduces a lot of other potential headaches. Will have to think about that one.
Loading Profile...



EMPLOYEE