Sep 07, 2008, 02:13 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: 1 [2]   Go Down
  Print  
Author Topic: [ Snippet ] Breadcrumbs MODx-ified  (Read 15280 times)
0 Members and 2 Guests are viewing this topic.
eemi
Moderators
*
Posts: 126


WWW
« Reply #15 on: Apr 14, 2006, 03:38 PM »

My english is a shame. But if  $pathThruUnPub works as you said, the detail info about how it works is not right.

   // $pathThruUnPub [ 1 | 0 ]
   // When you path includes an unpublished folder, setting this to
   // 1 will show all documents in path EXCEPT the unpublished.

What I understand is that if 1 will show all documents in path EXCEPT the unpublished, 0 obvioulsy  will show all documents in path including the unpublished.

I`m right? Or my english is worse that what i think?

cheers
Logged

patagonia, argentina
jaredc
Coding Team
*
Posts: 286



« Reply #16 on: Apr 18, 2006, 07:12 AM »

Here's the down low:

Unpublished docs are NEVER SHOWN.

pathThruUnpub = true
All PUBLISHED documents from current to root page are shown.

pathThruUnpub = false
All PUBLISHED documents from current up to root OR first UNpublished document are shown.

Quote from: documentation

   // $pathThruUnPub [ 1 | 0 ]
   // When you path includes an unpublished folder, setting this to
   // 1 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)
   if(!isset($pathThruUnPub)) $pathThruUnPub = 1;
From the documentation example structure (UNpublished docs in all caps):
home > news > CURRENT > SPORTS > skiiing > article

Note how the two example paths from the documentation differ:
$pathThruUnpub = true: home > news > skiiing > article
$pathThruUnpub = false: home > skiiing > article

In the (false) example, "news" is missing. The snippet starts from the current document, in this case "article" and moves up the tree including published documents (skiing) until it hits an unpublished document (SPORTS) at which time it stops. If the home crumb is turned on, then home is added as well, as shown in the example.

Does that help?
Logged

Standard Disclaimer
I could be totally wrong.
openfire3
Jr. Member
*
Posts: 41


benoitdeziel.com


WWW
« Reply #17 on: Apr 25, 2006, 08:50 AM »

Here's an example:  /dir1/dir2/dir3/dir4

A page that calls Breadcrumbs from dir2 will show the correct URL for dir1. 
But, a page at dir3 shows link to:
dir2 as: /dir1/dir2/dir1/page.html          # extra dir1
dir1 as:  /dir1/dir2/page.html                # extra dir2
home as:  /dir1/dir2/page.html               # extra dir2

With 4 levels, the problem gets worse, dir4 shows links to:
dir 3 as: 12312       # extra /dir1/dir2 appended
dir2 as: 1231          # extra dirs:  3,1
dir1 as: 123            # extra dirs:  2,3
home as: 123         #  extra dirs:  2,3

I have the same problem, did someone found a workaround?
Logged

Benoit Déziel
Graphiste & Web Designer
grad
Coding Team
*
Posts: 139


« Reply #18 on: May 27, 2006, 04:14 AM »

I made a small modification to the snippet. It didn't work correctly when called from within a chunk with parameters. Instead of applying overridden values it was falling back to those set in the snippet code. It also didn't accept 'longtite' and 'introtext' for crumb title and description.

Changes:
  • redefinition of variable statements - now overrides from the call should work fine
  • 'longtitle' and 'introtext' added to the pool of available title and description fields
  • added $homeCrumbDescription - a custom home link description in case you'd need it

My modification is based on Breadcrumbs ver. 0.9c dated 2006.03.29. I'm not a coder, so I can't guarantee it will work for everyone. I just thouhgt of sharing it as it does work for me.

* snippet.BreadcrumbsMod.txt (6.49 KB - downloaded 466 times.)
« Last Edit: May 27, 2006, 04:25 AM by grad » Logged

Polish MODx Community/Polskie forum MODx
- MODx, GPL i Ty

- GetField - the ultimate way to get any document content field
- SiteMap - Google sitemaps in MODx
- PHP Markdown plugin

This is the Web. The only thing you know about who will come is that you do not know who will come.
Dragon Company
Member
**
Posts: 67



WWW
« Reply #19 on: Jun 29, 2006, 01:24 PM »

Thanks a lot for that Path Snippet, very usefull Wink
Logged

spoof
Jr. Member
*
Posts: 18


« Reply #20 on: Dec 08, 2006, 10:40 AM »

Here's an example:  /dir1/dir2/dir3/dir4

A page that calls Breadcrumbs from dir2 will show the correct URL for dir1. 
But, a page at dir3 shows link to:
dir2 as: /dir1/dir2/dir1/page.html          # extra dir1
dir1 as:  /dir1/dir2/page.html                # extra dir2
home as:  /dir1/dir2/page.html               # extra dir2

With 4 levels, the problem gets worse, dir4 shows links to:
dir 3 as: 12312       # extra /dir1/dir2 appended
dir2 as: 1231          # extra dirs:  3,1
dir1 as: 123            # extra dirs:  2,3
home as: 123         #  extra dirs:  2,3

I have the same problem, did someone found a workaround?

Have the same problem too. How i can fix it?

update: i have prepared the hack:
in that part of code:
Quote
   
while (($parent=$modx->getPageInfo($pid,!$pathThruUnPub,"id,pagetitle,menutitle,published,deleted,parent,hidemenu,description,longtitle,introtext")) && ($crumbCount < $maxCrumbs)) {
        if ($parent['published'] && !$parent['deleted'] && $parent['id'] != $modx->config['site_start']){
            if (!$respectHidemenu || ($respectHidemenu && $parent['hidemenu'] != 1 )){
                $titleToShow = ($parent[$titleField])? $parent[$titleField] : $parent['pagetitle'] ;
                $descriptionToUse = ($parent[$descField]) ? $parent[$descField] : $parent['pagetitle'] ;
                $ptarr[] = '<a class="B_crumb" href="[~'.$parent['id'].'~]" title="'.$descriptionToUse.'">'.$titleToShow.'</a>';

change  href="[~'.$parent['id'].'~]" to href="[(base_url)][~'.$parent['id'].'~]":

Quote
   
while (($parent=$modx->getPageInfo($pid,!$pathThruUnPub,"id,pagetitle,menutitle,published,deleted,parent,hidemenu,description,longtitle,introtext")) && ($crumbCount < $maxCrumbs)) {
        if ($parent['published'] && !$parent['deleted'] && $parent['id'] != $modx->config['site_start']){
            if (!$respectHidemenu || ($respectHidemenu && $parent['hidemenu'] != 1 )){
                $titleToShow = ($parent[$titleField])? $parent[$titleField] : $parent['pagetitle'] ;
                $descriptionToUse = ($parent[$descField]) ? $parent[$descField] : $parent['pagetitle'] ;
                $ptarr[] = '<a class="B_crumb" href="[(base_url)][~'.$parent['id'].'~]" title="'.$descriptionToUse.'">'.$titleToShow.'</a>';
« Last Edit: Dec 08, 2006, 10:54 AM by spoof » Logged
OpenGeek
MODx Co-Founder
Foundation
*
Posts: 4,670


looking a little more like my avatar again...


WWW
« Reply #21 on: Dec 08, 2006, 11:45 AM »

Your template needs a base tag...
http://modxcms.com/forums/index.php/topic,1942.msg22795.html#msg22795
Logged

Jason Coward
MODx Co-Founder
xPDO Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
  — Frank Herbert
Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!