3 Replies Latest reply: Apr 29, 2014 3:25 AM by Gerardo Rodriguez RSS

    Get root page id from site

    user8865151

      Hello, I want to retrieve the page root id from my site, I have the site id:

          <publication:load name="pub" field="name" value='<%= ics.GetVar("site") %>'/>

          <publication:get name="pub" field="id" output="siteId"/>

       

      But I only can use the root page on this way (Putting id number directly):

          <asset:load name="page" type="Page" objectid='1383138063631' />

       

      I have to get these number with code, can any help me? Thanks

        • 1. Re: Get root page id from site
          Gerardo Rodriguez

          Hello,

          I think the tag you need is siteplan:root http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/siteplan-root.html

          Something like:

          %><publication:load name="IdSite" field="name" value="<%=site%>"/><%

            %><publication:get  name="IdSite" field="id" output="pubidCS"/><%

            %><siteplan:root list="listRoot" objectid="<%=ics.GetVar("pubidCS")%>"/><%

            IList listRoot = ics.GetList("listRoot");

            %><siteplan:load name="firstLevel" nodeid='<%=listRoot.getValue("nid")%>'/><%

            %><siteplan:listpages name="firstLevel" placedlist="pageFirstLevelList" level="1"/><%

           

          In the list pageFirstLevelList you will have all the first level pages.

          Hope it helps,

          Gerardo

          • 2. Re: Get root page id from site
            user8865151

            Hello,

             

            I try with this:

                <%-- Obtenemos el id del site --%>

                <publication:load name="pub" field="name" value='<%= ics.GetVar("site") %>'/>

                <publication:get name="pub" field="id" output="siteId"/>

              

                <siteplan:root list="rootNode" objectid="<%= ics.GetVar("siteId") %>"/>

                <ics:listget fieldname="value" listname="rootNode" output="rootId"/>

             

            But not works, siteplan tag cause error.

             

            I need only the first "root" page, becausea I have a couple of bucles that loop from the levels after, but I need get the "start point"

            • 3. Re: Get root page id from site
              Gerardo Rodriguez

              Hello,

              I think I understand your requirement. You should get the list and get the first element of it to have the first node. It is a ordered list so if you have more than one root page you could discriminate the one you are looking for.

              Have you imported the siteplan taglib? Which error do you get? As you can see the tag is so simple and the only parameter is the site Id.

              Cheers,

              Gerardo