<$mt:SubFolderRecurse$>

Recursively call the <mt:SubFolders> or <mt:TopLevelFolders> container with the subfolders of the folder in context. This tag, when placed at the end of loop controlled by one of the tags above will cause them to recursively descend into any subfolders that exist during the loop.

Because folders are essentially categories for pages, most of the mtml category tags also work for folders.

Attributes

  • max_depth (optional) - Specifies the maximum number of times the system should recurse. Default: infinite depth.

Examples

  • Create recursive list of folders/subfolders, linking those with pages to the respective folder archive page.

    <mt:TopLevelFolders>
        <mt:SubCatIsFirst><ul></mt:SubCatIsFirst>
            <mt:If tag="FolderCount">
                <li><h3><a href="<$mt:CategoryArchiveLink$>" <mt:Ignore>NOTE: there is no "folder" equivalent of this category-specific tag.</mt:Ignore>
                title="<$mt:FolderDescription$>"><mt:FolderLabel></a> (<$mt:FolderCount$>)</h3>
            <mt:Else>
                <li><h3><$mt:FolderLabel$> (<$mt:FolderCount$>)</h3>
            </mt:If>
            <$mt:SubFolderRecurse$>
            </li>
        <mt:SubCatIsLast></ul></mt:SubCatIsLast>
    </mt:TopLevelFolders>
    

    Or more simply:

    <mt:TopLevelFolders>
      <$mt:FolderLabel$>
      <$mt:SubFolderRecurse$>
    </mt:TopLevelFolders>
    
  • List pages in each folder, recursively. This will take a while to publish if you have many categories and pages.

    <mt:TopLevelFolders>
        <mt:SubCatIsFirst><ul></mt:SubCatIsFirst>
            <mt:If tag="FolderCount">
                <li><h3><a href="<$mt:CategoryArchiveLink$>"
                title="<$mt:FolderDescription$>"><mt:FolderLabel></a> (<$mt:FolderCount$>)</h3>
            <mt:Else>
                <li><h3><$mt:FolderLabel$> (<$mt:FolderCount$>)</h3>
            </mt:If>
            <mt:Pages>
                <mt:If name="__first__"><ul></mt:If>
                    <li><a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a></li>
                <mt:If name="__last__"></ul></mt:If>
            </mt:Pages>
            <$mt:SubFolderRecurse$>
            </li>
        <mt:SubCatIsLast></ul></mt:SubCatIsLast>
    </mt:TopLevelFolders>
    
This page was last updated on 2009-05-22, 14:15. [Edit]

2 Notes

I've updated docs for the <$mt:SubFolderRecurse$> tag with tested examples, they were horribly wrong.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.