We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8416
    • 173 Posts
    Hello,
    I’d like to add a class to each sub menu as follow:

    < ul class="documentID_Parent" >
    <li> .......</li>
    <li> ..... </li>
    </ul>

    How can I write a chunk that would get the parent document ID for the current document?

    I need someting like:

    <ul class="docIDParent">
    [+wf.wrapper+]
    </ul>

    Thanks for helping out.
      • 7231
      • 4,205 Posts
      You need to set a &innerTpl chunk:

      &innerTpl
      default: NULL
      values: name of template chunk
      description: The innerTpl template is used as a wrapper for each submenu. If no innerTpl is specified the outerTpl is used in its place. Each item processed in the submenu will be inserted into the placeholder [+wf.wrapper+].
      available placeholders: Same as OuterTpl.
      example:

          <ul[+wf.classes+]>
          	[+wf.wrapper+]
          </ul>



      Then set the chunk to use the [+wf.docid+] placeholder in this chunk to get the parent ID:
          <ul class="[+wf.docid+]">
          	[+wf.wrapper+]
          </ul>


      Note, I am not sure that you can have class names begining with numbers so you may need to do something like:
      id[+wf.docid+] (or add some char before the numbers).
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 8416
        • 173 Posts
        Thanks for your reply. I’ve tried that but I can’t get the doc Id

        I created a innerTpl "cssplay_inner":

        <ul class="id[+wf.docid+]">
        [+wf.wrapper+]
        </ul>

        I’m invoking it as
        [[Wayfinder? &startId=`0` &level=`3` &parentClass=`drop` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`menu` &cssTpl=`cssplay_dropdown`]]

        However the code generated doesn’t get the docID. [+wf.docid+] is an empty string. I only get

        <ul class="id">
        <li.......
        </ul>

        Do you know why? Also wf.docid should return the documentId. Is there a way to get the document’s parent id?

        Thanks again....

        Eric



          • 7231
          • 4,205 Posts
          I see why it does not work. My bad. But the innerTpl does not support those place holders. I will need to think a bit on this and get back to you.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 7231
            • 4,205 Posts
            I was unable to find a way to style the inner <ul> with a unique class or id (you can set a innerClass but will not be unique). It apperas that the innerTpl (and the outerTpl) do not have access to the full placeholders since they are considered wrappers and do not actually display any rows (thus no related document). I think the solution would be to add the unique ID to the parent of the sub:

            <li class="ID19"> link text
            <ul>
            <li>......
            </ul>
            </li>

            then style it by (or something like this): li.ID19 ul {style...}

            Note: You can also use the [+wf.id+] placeholder to add a unique ID (not class) to each field (use together with the &rowIdPrefix to set a prefix for the id).

            <li id="ID19" class="active"> link text
            <ul>
            <li>......
            </ul>
            </li>


            or in other words, something like this for the rowTpl...
            <li[+wf.id+][+wf.classes+]>
            <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
            [+wf.wrapper+]
            </li>

            Maybe someone else knows a trick that I have overlooked.

            then style: li#ID19 ul {style..}
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 8416
              • 173 Posts
              Thanks i’ll give it a try....