I am sure your code is correct, but it doesn't work for me.
I probably don't understand my location in the xml properly.
I have modified BoostTextPage to include ten media pickers.
In an instance of a content page (Contact Us) I have assigned values to the first 3 media Pickers.
If I go to my xslt file and load a media picker like this I can access the named picker ok:
[code][/code]
but repeating my code to get a named mediaPicker and display it ten times looked really clumsy so I thought a loop seemed logical - but it's proving much harder than I expected.
If I do this I get zero
[code][/code]
aha! [slaps forehead]
The macro containing the xslt file is actually in BoostMaster not BoostTextPage. I bet I have to move up the tree to get the media pickers?
I'll keep on with it.
Phew, there is quite a steep learning curve for this. Great product though.
For each of those, check whether string(..) != '' and if so, grab the media file associated with the id.
A loop could do fine, but you'd need to find a way to construct 'rotatorImageX' as the identifier. Concat() will help, but I'm not sure on how to set the index? Maybe some other may have an answer to this.
Now I know the loop is genuinely tricky I can justifiably take the easy route and write out code for each named picker. I just wanted to check I wasn't missing a trick.
Got intrigues by your question, so I decided to give it a google-go and found an interesting snippet at http://snippets.dzone.com/tag/loop which I've changed to:
[code]
[/code]
Other may have other solutions, I'd be glad to hear about it...
How to list all Media Pickers in $currentPage
Hi,
How do I loop through all Media Pickers in $currentPage?
I have tried and failed (all day) to loop through each node and if it's a media picker to output the url.
Can somebody point me in the right direction please?
I thought this might work? but no. You can see I am struggling.
[code]
[/code]
Many Thanks,
Neil
Hi,
Hope this is not a typo (Mind the /node I've added on the for-each loop):
[code][/code]
Regards,
/Dirk
Thanks again for your help Dirk.
I am sure your code is correct, but it doesn't work for me.
I probably don't understand my location in the xml properly.
I have modified BoostTextPage to include ten media pickers.
In an instance of a content page (Contact Us) I have assigned values to the first 3 media Pickers.
If I go to my xslt file and load a media picker like this I can access the named picker ok:
[code][/code]
but repeating my code to get a named mediaPicker and display it ten times looked really clumsy so I thought a loop seemed logical - but it's proving much harder than I expected.
If I do this I get zero
[code][/code]
aha! [slaps forehead]
The macro containing the xslt file is actually in BoostMaster not BoostTextPage. I bet I have to move up the tree to get the media pickers?
I'll keep on with it.
Phew, there is quite a steep learning curve for this. Great product though.
Thanks again for your help
Neil
Hi neil,
Also misread the post... all mediapickers belong to the same page, so iterating the child nodes of the currentPage won't work... my bad!
If you have created 10 media pickers on a page, they should all be available as:
$currentPage/data[@alias='rotatorImage1']
$currentPage/data[@alias='rotatorImage2']
...
$currentPage/data[@alias='rotatorImage10']
For each of those, check whether string(..) != '' and if so, grab the media file associated with the id.
A loop could do fine, but you'd need to find a way to construct 'rotatorImageX' as the identifier. Concat() will help, but I'm not sure on how to set the index? Maybe some other may have an answer to this.
Hope this helps.
Regards,
/Dirk
Now I know the loop is genuinely tricky I can justifiably take the easy route and write out code for each named picker. I just wanted to check I wasn't missing a trick.
x1000 Thanks,
Neil
Hi,
Got intrigues by your question, so I decided to give it a google-go and found an interesting snippet at http://snippets.dzone.com/tag/loop which I've changed to:
[code]
[/code]
Other may have other solutions, I'd be glad to hear about it...
/Dirk
is working on a reply...