We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    Hi,

    I’m using PageTrail snippet, but it only shows the first 2 pages. S if I have a hierarchical documents such as this, PageA > PageB > PageC > PageD, then it will only display PageC > PageD, when you are in PageD. If you’re in PageC, then it will display PageB > PageC.

    Do you guys have any idea?

    Thanks
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
      • 32241
      • 1,495 Posts
      I’m assuming this is the problem
      while ($parent=$etomite->getPageInfo($pid)) {

      Which in fact it’s the problem. It doesn’t shows the parent, when the snippet call
      $parent['parent']


      I change the etomite to modx, but it’s still not working. I believe the API has a bugs, which doesn’t return the whole page info.

      Let me investigate this further.
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 32241
        • 1,495 Posts
        Fix it

        /*
         * PageTrail - updated to work with MODx
         *
         * Properties:
         *
         *	&sep 	- page trail separator
         *	&style	- inline style
         *	&class	- style sheet name
         */
         
        
        $sep = isset($sep) ? $sep :" » ";
        $style = isset($style) ? " style=\"$style\" " :"";
        $class = isset($class) ? " class=\"$class\" " :"";
        
        // end config
        $ptarr = array();
        $cid = $modx->documentObject['id'];
        $pid = $modx->getParent($cid,1,"id");
        $ptarr[] = "<a $class $style href='[~".$etomite->documentObject['id']."~]'>".$etomite->documentObject['pagetitle']."</a>";
        
        while ($parent=$modx->getPageInfo($pid['id'])) {
            $ptarr[] = "<a $class $style href='[~".$parent['id']."~]'>".$parent['pagetitle']."</a>";
            $pid = $modx->getParent($parent['id'],1,"id");
        }
        
        $ptarr = array_reverse($ptarr);
        return join($ptarr, $sep);
        


        Hope that helps other users...
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 22301
          • 1,084 Posts
          // --------------------
          // Snippet: Breadcrumbs
          // --------------------
          // Version: 0.6e
          // Date: 2005.05.26
          // [email protected]
          //
          // This snippet was designed to show the
          // path through the various levels of
          // site structure back to the root. It
          // is NOT necessarily the path the user
          // took to arrive at a given page. Based on
          // PageTrail snippet by: Bill Wilson.
          //
          
          // Configuration Settings
          
             // $maxCrumbs [number]
             // Max number of elements to have in a path.
             // 100 is an arbitrary high number.
             // If you make it smaller, like say 2, but you
             // you are 5 levels deep, it will appear as:
             // Home > ... > Level 4 > Level 5
             // It should be noted that "Home" and the current
             // page do not count. Each of these are configured
             // separately.
             $maxCrumbs = 100;
          
             // $pathThruUnPub [ true | false ]
             // When you path includes an unpublished folder, setting this to 
             // true will show all documents in path EXCEPT the unpublished.
             // Example path (unpublished in caps)
             // home > news > CURRENT > SPORTS > skiiing > article
             // $pathThruUnPub = true would give you this:
             // home > news > skiiing > article
             // $pathThruUnPub = false  would give you this:
             // home > skiiing > article (assuming you have home crumb turned on)
             $pathThruUnPub = true;
          
             // $showHomeCrumb [true | false]
             // Would you like your crumb string to start
             // with a link to home? Some would not because
             // a home link is usually found in the site logo
             // or elsewhere in the navigation scheme.
             $showHomeCrumb = true;
          
             // $showCrumbsAtHome [ true | false ]
             // You can use this to turn off the breadcrumbs on the
             // home page.
             $showCrumbsAtHome = false;
          
             // $showCurrentCrumb [true | false]
             // Show the current page in path
             $showCurrentCrumb = true;
          
             // $currentAsLink [true | false]
             // If you want the current page crumb to be a
             // link (to itself) then make true.
             $currentAsLink = false;
          
             // $crumbSeparator [string]
             // Define what you want between the crumbs
             $crumbSeparator = "»";
          
             // $homeCrumbTitle [string]
             // Just in case you want to have a home link,
             // but want to call it something else
             $homeCrumbTitle = 'Ãëàâíàÿ';
          
          // ***********************************
          // END CONFIG SETTINGS
          // THE REST SHOULD TAKE CARE OF ITSELF
          // ***********************************
          
          // Check for home page
          if ($showCrumbsAtHome || (!$showCrumbsAtHome && ($etomite->documentIdentifier != $etomite->config['site_start'])) ){
          
            //initialize crumb array
            $ptarr = array();
            // get current page parent id
          	$docInfo = $etomite->getDocument($etomite->documentIdentifier);
            $pid = $docInfo['parent'];
            // show current page, as link or not
            if ($showCurrentCrumb){
              if ($currentAsLink){
                $ptarr[] = '<a href="[~'.$etomite->documentIdentifier.'~]" title="'.$docInfo['longtitle'].'">'.$docInfo['pagetitle'].'</a>';
              } else {
                $ptarr[] = '<h1 class="pagetrail">'.$docInfo['pagetitle'].'</h1>';
              }
            }
            // assemble intermediate crumbs
            $crumbCount = 0;
            $activeOnly = ($pathThruUnPub)? 0 : 1;
            while (($parent=$etomite->getPageInfo($pid,$activeOnly,"id,pagetitle,longtitle,published,deleted,parent")) && ($crumbCount < $maxCrumbs)) {
              if ($parent['published'] && !$parent['deleted'] && $parent['id'] != $etomite->config['site_start']){
                $ptarr[] = '<a href="[~'.$parent['id'].'~]" title="'.$parent['longtitle'].'">'.$parent['pagetitle'].'</a>';
              }    
              $pid = $parent['parent'];
              $crumbCount++;
            }
            // insert '...' if maximum number of crumbs exceded
            if ($parent != 0){
              $ptarr[] = '...';
            }
            // add home link if desired
            if ($showHomeCrumb && ($etomite->documentIdentifier != $etomite->config['site_start'])){
              $ptarr[] = '<a href="[~'.$etomite->config['site_start'].'~]" title="'.$homeCrumbTitle.'">'.$homeCrumbTitle.'</a>';
            }
          
            $ptarr = array_reverse($ptarr);
            return join($ptarr, " $crumbSeparator ");
          
          } // end check if home page
          
          
            [img]http://jurist-info.ru/pic/rrr.jpg[/img]

            Безжалостный пияр!
            Artima -- неуч!
            Осторожно: преступная локализация -- modx-cms.ru
            Баштанник Андрей -- мегапрограммер из Белоруссии и поедатель говна, очень критично настроенный молодой человек!

            Дисклеймер для общительных: даю сам себе право транслировать в открытый эфир содержание лички, just for fun
            • 13577
            • 302 Posts
            Dang... I’m going to have to update Breadcrumbs for MODx too.

            Breadcrumbs is configurable to the max. But it doesn’t account for hidden menu items. This is a pretty consistent problem with all my navigation snippets I developed for Etomite (which doesn’t have the "show in menu" checkbox option).

            [ mutters unitelligibly as he wanders away scribbling on his to-do list ]
              Standard Disclaimer
              I could be totally wrong.
              • 32241
              • 1,495 Posts
              Hi guys, I was just wondering, whether this fix had been comited to the SVN or not. For now, version 0.9.1 still have the same problem, it’s only showing 2 trails at a time, if ther eis more, it will remove the first trails.

              Thanks
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
              • Hi wendy, Jaredc’s breakcrumb snippet is just what you’re looking ffor...
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 32241
                  • 1,495 Posts
                  Ah OK, I was just wondering, because PageTrail is still being included on version 0.9.1. Any thought this will be replaced with BreadCrumb snippet from JaredC? To avoid confussion to some people, when thy thougth PageTrail will do what they want, but in fact it has some limitation.

                  Just a suggestion.
                    Wendy Novianto
                    [font=Verdana]PT DJAMOER Technology Media
                    [font=Verdana]Xituz Media
                    • 6102
                    • 17 Posts
                    I would like to use the Breadcrumb code but... I’m Clueless.
                    Where do I put the breadcrumb code found above and how do I call it in my HTML template?
                      • 32241
                      • 1,495 Posts
                      Go to resources -> snippett in the manager.

                      Create a new snippet, and put the name as BreadCrumb or whatever that you want, then copy paste the code to the text box for the snippet code. Save the snippet.

                      Then on your page, call it with [[BreadCrumb]], or you can use the name that you specified when you create the snippet.

                      That’s all grin
                        Wendy Novianto
                        [font=Verdana]PT DJAMOER Technology Media
                        [font=Verdana]Xituz Media