Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Breadcrumbs, again

Hi there. I'm one of those parasites who finally jumped on board of the SS CD when I saw the unbeatable upgrade offer. Please bear with me as I take my first baby steps with a CMS.

With the CityScript extensions in CityDesk 2.0, shouldn't it be possible to create breadcrumbs without the JavaScript kludge posted previously in the discussion forums?

Reason for doing this: I get a lot of visitors with Active Scripting off (IE security holes do that to people), yet I'd still be able to offer them a Breadcrumbs navigation bar. As in:

Fog Creek > Citydesk > Discussion Forums > New Topic

which comes down to:

Site Name > Section (or folder) Name > Subfolder (or Subsection) name > Current Page Name

This should probably become a set of conditions which goes into a variable which I could call up from any page.

I haven't found a way to do this, though. Am I too clumsy or too ambitious with my first steps in CityDesk? I.e. can it be done? Erm... please?

geraldH
Tuesday, August 26, 2003

That gets my vote too.  I too would like a better / easier way to create heirarchical navigation within CD.

I could even do it myself, if there was also an option to "Run this external program *BEFORE* site generation", as I could write a program to go through the site articles, and put navigation bar code into (say) the Extra1 field for inclusion in the template.

I'll probably still write the add-on anyway, but it would be very nice for it to fit into the "publishing" process seamlessly.

Paul T
Tuesday, August 26, 2003

Gerald,

Not sure if you are clumsy, but as far as I know breadcrumbs can't be done with CD2.  Version 2 added nice features for scripting, including 'thisFolder', previous, next stuff, but it won't do stuff like folder "..".  You are in a sizable group of people who have wanted that kind of feature though.  Maybe v3 will move that way.

But if someone figures out a way with v2, show and tell!

Joel Goldstick
Tuesday, August 26, 2003

To me, the main issue seems how to find out the name of the current folder and the folder above. Perhaps one could do this by the way of some dummy articles within each folder, do a keyword search?

geraldH
Tuesday, August 26, 2003

My suggestion for the best way to do it within the limitations of CityDesk is to put a tiny article named "breadcrumb" in each folder, containing the breadcrumbs that are appropriate for that particular folder. Then use the CityScript

{$ foreach b in
          (and (thisFolder) (fileName "breadcrumb")) $}
    {$ b.body $}
{$ next$ }

in your templates to create the breadcrumbs.

The manual part is that you have to make these breadcrumb articles manually. Set them to use a completely blank template so they don't produce any files themselves.

This is not ideal, but since with most sites the folder structure changes very rarely, if at all, this should be adequate.

Joel Spolsky
Tuesday, August 26, 2003

If your server supports PHP, that would be a better alternative than JavaScript for creating the breadcrumb links. It doesn't matter what your visitor's browser settings are, the server will stick in the correct HTML.

You could then stick the PHP script inside a CityDesk variable, which can go into your page template in the appropriate place.

Darren Collins
Tuesday, August 26, 2003

How would you do it with a PHP script (for the php-illiterate)?

john doe
Wednesday, August 27, 2003

I uploaded a knowledge base article and a complete sample CityDesk site showing how to do breadcrumbs with almost no manual maintenance. (You'll still have to add the crumbs when you create a new folder).

http://www.citydesknews.com/CityDesk/kb/howto/Breadcrumbs.html

Joel Spolsky
Wednesday, August 27, 2003

I use Adriaan van den Brand's simple but effective JavaScript technique.

http://discuss.fogcreek.com/CityDesk/default.asp?cmd=show&ixPost=3517&ixReplies=2

Once you set it up, all you have to do is add an "index" file to each folder, and make sure you don't publish the index file.  It's fairly easy.

George
Wednesday, August 27, 2003

Thanks for all the input. The php solutions are beyond my reach, but the more pedestrian advice is serving me well.

geraldH
Wednesday, August 27, 2003

I have the breadcrumbs in PHP (including fast prev/next too ;-)

I've just never found the time to document it thoroughly so it could be used by anyone... it works fine though.

Anyone who would like to take my script and clean it up for educational use?

Adriaan van den Brand
Thursday, August 28, 2003

Hi Joel,

I still have one question concerning the technique you describe using the extra2 field. How do I enter the appropiate links in the extra field? When I enter them there they get pulled as is into the page, not as a link.

Christian
Thursday, August 28, 2003

Ok,

sorry, just found out I have to use variables ;)

Chris

Christian
Thursday, August 28, 2003

I've posted my php breadcrumb code to Armin Hanisch and to the template webmaster. Feel free to use and improve it!

Adriaan van den Brand
Friday, August 29, 2003

Already writing some detailed explanation for
a) "I just want to use it" persons
and
b) "Tell me how it works" persons,
hope it will be finished this weekend. Adrian already did most of the job...

Armin
Friday, August 29, 2003

Oops, sorry Adriaan, missed the "a"

Btw, if somebody needs some explanations later on, I'm native German, so you can get in touch with me in German also.

Armin
Friday, August 29, 2003

*  Recent Topics

*  Fog Creek Home