Hey guys, I want users to be able to add components to an area. Now in the
component I would like to check the number of the component.
I want to do this, because on a higher level (parent component) I want to
switch the content with the contained components.
I could fix this with javascript (set the component number after page has been
loaded), but I rather have an ftl / magnolia solution.
Any ideas?
This is the way I create the menu:
[code]
[#-- Assigns --]
[#assign childNumber = 0]
[#assign childrenAreas = cmsfn.children(content, "mgnl:area")!]
[#--- Switching content in this component by using a menu ---]
<div class="row">
<div id="carousel" class="content-switcher inner-container carousel"
data-ride="carousel">
<ol class="carousel-menu">
[#list childrenAreas as area]
[#assign amountOfChildren = cmsfn.children(area,
"mgnl:component")?size!]
[#assign childrenComponents = cmsfn.children(area,
"mgnl:component")!]
[#list childrenComponents as child]
[#if childNumber == 0]
[#assign firstChild = "active" /]
[#else]
[#assign firstChild = "" /]
[/#if]
<li data-target="#carousel" class="${firstChild!""}"
data-slide-to="${childNumber!""}">${childNumber!"Child number is missing"}
test</li>
[#assign childNumber = childNumber+1 /]
[/#list]
[/#list]
</ol>
<div class="carousel-inner" role="listbox">
[@cms.area name="contentSwitcherItems" /]
</div>
</div>
</div>
[/code]
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=0d4a52e6-03bd-4b09-8313-cb731cedab1c
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------