We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26439
    • 104 Posts
    Nevermind, one just just magically appearred

    ........ searching for one at the moment, anyone happen to have one handy?
      • 25663 MODX Staff
      • 12,272 Posts
      Jared, you around? wink
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 26439
        • 104 Posts
        May as well post it for the next person doing a search...... hate to waste a good thread

        // --------------------
        // Snippet: ListSiteMap
        // --------------------
        // Version: 0.6h
        // Date: 2006.01.20
        // [email protected]
        //
        // This snippet was designed to show a nested
        // list site map with each pagetitle being a
        // link to that page. It will not include
        // unpublished folders/pages OR its children,
        // even if the children ARE published.
        
        // Config
           // $siteMapRoot [int]
           // The parent ID of your root. Default 0. Can be set in 
           // snippet call with LSM_root (to doc id 10 for example):
           // [[ListSiteMap?LSM_root=10]]
           $siteMapRoot = 0;
        
           // $showDescription [true | false]
           // Specify if you would like to include the description
           // with the page title link.
           $showDescription = false;
        
           // $titleOfLinks [ string ]
           // What database field do you want the title of your links to be?
           // The default is pagetitle because it is always a valid (not empty)
           // value, but if you prefer it can be any of the following:
           // id, pagetitle, description, parent, alias, longtitle
           $titleOfLinks = 'pagetitle';
           
           // $removeNewLines [ true | false ]
           // If you want new lines removed from code, set to true. This is generally
           // better for IE when lists are styled vertically. 
           $removeNewLines = true;
           
           // $maxLevels [ int ]
           // Maximum number of levels to include. The default 0 will allow all
           // levels. Also settable with snippet variable LSM_levels:
           // [[ListSiteMap?LSM_levels=2]]
           $maxLevels = 0;
           
           // $selfAsLink [ true | false ]
           // Define if the current page should be a link (true) or not
           // (false)
           $selfAsLink = false;
           
           // $showUnpubs [ true | false ]
           // Decide to include items in unpublished folders. This will show the
           // unpublished items as well. No links will be made for the unpublished items
           // but they will be shown in the structure. You will not likely want to do
           // this but the option is yours.
           $showUnpubs = false;
        
        // Styles
        //
        // .LSM_currentPage    span surrounding current page if $selfAsLink is false
        // .LSM_description    description of page
        // .LSM_N              ul style where N is the level of nested list- starting at 0
        
        // ###########################################
        // End config, the rest takes care of itself #
        // ###########################################
        
        // Initialize
        $siteMapRoot = (isset($LSM_root))? $LSM_root : $siteMapRoot ;
        $maxLevels = (isset($LSM_levels))? $LSM_levels : $maxLevels ;
        $ie = ($removeNewLines)? '' : "\n" ;
        
        // Overcome single use limitation on functions
        
        if(!function_exists('MakeSiteMap')){
          function MakeSiteMap($funcmodx, $listParent, $listLevel, $description, $titleOfLinks,$maxLevels,$su,$selfAsLink){
            $children = $funcmodx->getAllChildren($listParent, 'menuindex', 'ASC', 'id, pagetitle, description, parent, alias, longtitle, published');
            $output .= '<ul class="LSM_'.$listLevel.'">'.$ie;
            foreach($children as $child){
            
              // skip unpubs unless desired
              if (!$su && !$child['published']) continue;
              
              $descText = ($description)? ' <span class="LSM_description">'.$child['description'].'</span>' : '';
              $output .= '<li>';
              if ((!$selfAsLink) && ($child['id'] == $funcmodx->documentIdentifier)){
                $output .= '<span class="LSM_currentPage">'.$child['pagetitle'].'</span>';
              } else if (!$child['published']){
                $output .= '<span class="LSM_unpubPage">'.$child['pagetitle'].'</span>';
              } else {
                $output .= '<a href="[~'.$child['id'].'~]" title="'.$child[$titleOfLinks].'">'.$child['pagetitle'].'</a>';
              }
              $output .= $descText;
              if ($funcmodx->getAllChildren($child['id']) && (($maxLevels==0) || ($maxLevels > $listLevel+1 ))){
                $output .= MakeSiteMap($funcmodx,$child['id'],$listLevel+1,$description,$titleOfLinks,$maxLevels,$su,$selfAsLink);
              }
              $output .= '</li>'.$ie;
            }
            $output .= '</ul>'.$ie;
            return $output;
          }
        }
        
        return MakeSiteMap($modx, $siteMapRoot, 0, $showDescription, $titleOfLinks,$maxLevels,$showUnpubs,$selfAsLink);
        
          • 6726
          • 7,075 Posts
          You could also use the DropMenu snippet to build your sitemap page... what I did so far...

          Never checked this one, most definitely will to check the differences


            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 23491 ☆ A M B ☆
            • 1,056 Posts
            I wonder if this same feat could be easily accomplished with Wayfinder huh
              Mike Reid - www.pixelchutes.com
              MODx Ambassador / Contributor
              [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
              ________________________________
              Where every pixel matters.