[thelist] PHP breadcrumbs & directory navigation

kristina ml at kfxdesign.net
Thu Jan 23 04:56:01 CST 2003


[WARNING long and complicated message....]

evolters,

  I'm learning breadcrumbs...!  And in so doing
  have learnt that the best way for breadcrumbs to
  work, they should ideally use the directory
  structure of the website.

  The way I have this particular site set up, I
  have a dir with all included files a directory
  for css and a directory for images.

  I then had all the actual PHP pages, in the
  root.

  Too implement the breadcrumbs I proceeded to
  create suitable directorys.  A couple of which
  go 2 or 3 layers deep.

  Which is all fine.

  Apart from the most basic of things.

  If I have the following:

  /incl
  /css
  /images
  /news/headlines/storys/newsStory1.php

  in newsStory1.php

  <?php
    include("../../../incl/conf.php");
    include("../../../incl/css.php");
    include("../../../incl/header.php");
    include("../../../incl/footer.php");
  ?>

  <img src="../../../images/logo.gif" />

  which kind of works, but I'm not convinced
  having all those ../../../ is a good idea!  It
  occurred to me to turn it into an explicit
  variable

  $baseurl = http://www.foo.com/

  so
  <img src="../../../images/logo.gif" />

  becomes
  <img src="<?php $baseurl ?>/images/logo.gif" />

  which again works some of the time

  My problem starts when I include

  /incl/header.php &
  /incl/footer.php

  there are also links to other parts of the site,
  images etc,

  now when header.php is included in:
  /news/headlines/storys/newsStory1.php

  the links and images break - I think this can
  pretty much be fixed by adding $baseurl

  and within header.php & footer.php I have
  variables that come from /incl/conf.php

  and they all break....

  My reason for using variables from within a
  single included file, is because I'm trying to
  make updating the site in the future as easy as
  possible.  As I'm V lazy when it comes to
  updating a site and being able to change one
  variable that in turn updates the rest of the
  site too me is bliss....!

  Now I have trawled the net for hours trying to
  find a beginners guide to breadcrumbs, and I
  really have had no success.  Although Jacob's
  article [1] on breadcrumb for PHP lovers is great,
  I can only get it to work to one level!  I have
  found a couple of other examples but again not
  very helpful to a complete novice.

  I think what I really need help with is how to
  sort the linkage (not sure if thats the right
  word) within the site.

  How do other people do this.  This has made my
  head spin!  And it seems to me to be one of the
  most basic things.  If you've read this far, I
  appreciate it, I'm not sure I've worded my
  problem very well, As I've become so confused in
  the process its all a bit of a muddle!

  [1]-<wrap>
  http://www.evolt.org/article/Breadcrumbs_for_PHP_Lovers/17/4455/
  </wrap>

--
tia
.kristina

ml at kfxdesign.net
kfxdesign.net




More information about the thelist mailing list