Main Content

Magnolia Community Forums: Get help with Magnolia: Getting list of available sites in FTL


  • shriduttkothari
    shriduttkothari
    Full name: shridutt kothari
    Posts: 4
    Last post: Dec 4, 2017 4:07:08 PM
    Registered on: Apr 10, 2017
    Getting list of available sites in FTL
    #1 by shriduttkothari on Dec 4, 2017 1:01:55 PM

    How can i get list of available sites in FTL.

    In Java there is option to get list of sites using DefaultSiteManager.getSites()

    but i am not able to find same for FTL.

  • shriduttkothari
    shriduttkothari
    Full name: shridutt kothari
    Posts: 4
    Last post: Dec 4, 2017 4:07:08 PM
    Registered on: Apr 10, 2017
    Re: Getting list of available sites in FTL
    #2 by shriduttkothari on Dec 4, 2017 4:07:08 PM

    Found a workaround:
    [#assign siteParameters = cmsfn.contentByPath("/modules/multisite/config/sites/${currentSiteName}/parameters", "config")!'' /]
    [#assign sitesNode = cmsfn.nodeByPath("/modules/multisite/config/sites/", "config")]
    <li>
    <select class="form-control" id="city" onchange="callDomainChange(value)">
    [#list cmsfn.children(sitesNode, "mgnl:contentNode") as child ]
    [#if child.name != 'fallback']
    <option value="${ctx.contextPath}/${child.name}/${pageNode}" [#if currentSiteName == child.name] selected = "selected"[/#if]>${child.name!'nothing'}</option>
    [/#if]
    [/#list]
    </select>
    </li>


You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/