HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[RESOLVED] Breadcrumbs ... changing default

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#60886 (In Topic #13239)
Avatar

Community saint

A while ago (ouch! I just checked and it was in 2006) I asked for help on how to selectively change the default for a catalogue-based breadcrumb. Chris took this one on personally and came up with a solution that worked for me EXACTLY as I had wanted it to. That was for version 3.x.x.

You can see all the exchanges here.

Subsequently, the 'workaround' was incorporated into all newer versions of site.php as a commented-out option, like so …

Code (php)

        // Data
        $segment_substitutions=array();
//      $target_url=build_url(array('page'=>'dictionary'),'site');
//      $segment_substitutions=array(
//              '\<a title="[^"]*" href="[^"]*/site/index.php\?page=catalogues&amp;type=misc[^"]*"\>Catalogues\</a\> &gt; '=>'',
//              '\<a title="[^"]*" href="[^"]*/site/index.php\?page=catalogues&amp;type=index&amp;id=contacts[^"]*"\>Index\</a\> &gt; '=>'<a title="Go backwards to" href="'.$target_url->evaluate().'">Dictionary</a> &gt; ',
//      );


 

Feeling pretty confident that it should work for site.php in any 4.x.x version I edited my site.php to this, and uploaded it to the sources_custom folder …

Code (php)

  // Data
        $segment_substitutions=array();
   $target_url=build_url(array('page'=>'vocab'),'site');
   $segment_substitutions=array(
      '\<a title="[^"]*" href="[^"]*/site/index.php\?page=catalogues&amp;type=misc[^"]*"\>Catalogues\</a\> &gt; '=>'',
      '\<a title="[^"]*" href="[^"]*/site/index.php\?page=vocab&amp;type=index&amp;id=vocab[^"]*"\>Index\</a\> &gt; '=>'<a title="Go backwards to" href="'.$target_url->evaluate().'">A-I Vocab</a> &gt; ',
   );
 

To cut to the chase ….. it doesn't!

Anybody have any idea why it doesn't?



Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#60894
Avatar

Hi,

Could you describe what you want to see and what you instead see. I ran a quick test and in principle it should still be working.
The only thing that came to mind is that we now only show breadcrumbs if they have a link in them due to a bit of code in GLOBAL.tpl:

Code

{+START,IF,{$IN_STR,{BREADCRUMBS},<a }}
...
{+END}


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#60896
Avatar

Community saint

Thanks for picking up on this, Chris.

A brief explanation: Like the original attempt in version 3.x.x, I've built a Comcode page as the jumping-off (entry) point for the particular catalogue (actually a series titled A-Z), to which I wish the users to return when they have finished perusing any particular catalogue, A-Z.

However, when unedited, the breadcrumb takes one back to the 'Catalogues' page. When edited, NO breadcrumb link appears!

The attachment explains what I see …



Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#60911
Avatar

Hi,

Okay, I've studied it a bit now. There are two changes in ocPortal 4 that are causing issues:
  1. Index links only show for non-tree catalogues now. I think you probably don't have one here, hence the lack of an index link even in the first/before shot.
  2. Even if you had a non-tree catalogue the index link would be the name of the catalogue now, rather than 'Index'.

From your screenshot I can see at least the first substitution works.

We'll have to change tactic. The substitutions I gave you before lock onto the parameter in the URL of the index page. Now we have nothing to lock onto, so we'll have to use keep_* parameters.

Code

   // Data
   $segment_substitutions=array();
   $root=get_param('keep_catalogue_root_page',NULL);
   if (!is_null($root))
   {
      $page_name=get_param('keep_catalogue_root_page_name');
      $target_url=build_url(array('page'=>$root),'_SEARCH');
      $segment_substitutions=array(
         '\<a title="[^"]*" href="[^"]*/site/index.php\?page=catalogues&amp;type=misc[^"]*"\>Catalogues\</a\> &gt; '=>'<a title="Go backwards to" href="'.escape_html($target_url->evaluate()).'">'.escape_html($page_name).'</a> &gt; ',
      );
   }

Any links into the catalogue will need to include this on the end:

Code

&keep_catalogue_root_page=dictionary&keep_catalogue_root_page_name=Dictionary
or in page-link style have this on the end:

Code

:keep_catalogue_root_page=vocab:keep_catalogue_root_page_name=Dictionary
Links to other catalogues should also use equivalents to these, otherwise they will all show as under Dictionary.

The nice thing about this technique is it is expandable, you can have different catalogues having different parents.

I think this is the best way. It's not ideal having to mess around with all your catalogue links, but I think it's better than hacking multiple places in the code.

Ultimately we want to implement a whole new system for managing breadcrumbs. Info about this is in the tracker, but it's a big change so won't happen soon.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#60912
Avatar

Community saint

Thanks, Chris.

Had a rushed attempt at it but ended up with the dreaded "Critical Error - bailing out" message!

Now I have to stop to tear the room apart (including computers, router, modems, fax and phones!) for the painters who arrive early tomorrow. Will pursue this when they've done their worst.

Standby for a further report ….

 :|

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#61094
Avatar

Community saint

Back again - to report continuing failures.

'Tried' to carefully follow your advice in your previous post. This is what I've managed so far:

Comcode start page = vocab
Name of Comcode page = A-I Vocabulary

PHP code

   // Data
   
$segment_substitutions=array();
   
$root=get_param('keep_catalogue_root_page','vocab');
   if (!
is_null($root))
   {
      
$page_name=get_param('keep_catalogue_root_page_name','A-I Vocabulary');
      
$target_url=build_url(array('page'=>$root),'_SEARCH');
      
$segment_substitutions=array(
         
'\<a title="[^"]*" href="[^"]*/site/index.php\?page=catalogues&amp;type=misc[^"]*"\>Catalogues\</a\> &gt; '=>'',
      
'\<a title="[^"]*" href="[^"]*/site/index.php\?page=vocab&amp;type=index[^"]*"\>A-I Vocabulary\</a\> &gt; '=>'<a title="Go backwards to" href="'.escape_html($target_url->evaluate()).'">'.escape_html($page_name).'</a> &gt; ',
      );
   }


1. Have I missed something?
2. The page renders, BUT it still omits the breadcrumb link.
3. Haven't figured out precisely where I should add the :keep parameters, and that is probably what is screwing up the whole game.

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#61101
Avatar

Try mine except when testing put this into the URL:

Code

&keep_catalogue_root_page=vocab&keep_catalogue_root_page_name=A-I Vocabulary

Like:

Code

http://example.com/index.php?page=catalogues&type=entry&id=3&keep_catalogue_root_page=vocab&keep_catalogue_root_page_name=A-I Vocabulary
(just an example, I'm not sure what your own URLs are going to be like)


That should at least confirm it can work, just leaving the issue of setting your links.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#61113
Avatar

Community saint

YESSSSSSSSS!!

I added the :keep ... etc. etc. to the URL's of the linked catalogues off the Comcode page and it works EXACTLY the way it did in version 3.x.x, and the way you said it would in this version.

For anybody else that wants to achieve the same result, it is worth noting for future use. The link looks like this …

PHP code

[page=&quot;site:catalogues:category:a:vocab-a:keep_catalogue_root_page=vocab:keep_catalogue_root_page_name=A-I+Vocab&quot;]A[/page] | [page=&quot;site:catalogues:category:b:vocab-b:keep_catalogue_root_page=vocab:keep_catalogue_root_page_name=A-I+Vocab&quot;]B[/page] | [page=&quot;site:catalogues:category:c:vocab-c:keep_catalogue_root_page=vocab:keep_catalogue_root_page_name=A-I+Vocab&quot;]C[/page]

---------------------------------------------------------------------------------------
(.......... and 
so on for each of the letters of the alphabet called in my catalogues ..........)
---------------------------------------------------------------------------------------



And here is the proof …


Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: