New to PHP help with breadcrumbs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tommylux

    #1

    New to PHP help with breadcrumbs

    Hi there So far I have designed a simple template file in PHP:

    <?php if(!$page) $page="home";
    if(file_exists( "/my root/public_html/progress/$page.html")) {
    include("/my root/public_html/progress/$page.html"); } else {
    include("/my root/public_html/progress/404.html"); } ?>

    Where I want the breadcrumbs, i have a: <?php print($location ); ?>

    and the content below breadcrumbs is: <?php print($content) ; ?>

    My example $page looks like this:

    <?php $location=" <a href=\"index.ph p?page=home\">H OME</a&nbsp »
    &nbsp <a href=\"index.ph p?page=\contact ">CONTACT US</a>";
    $content='<tabl e border="0" cellspacing="0" cellpadding="0"
    dwcopytype="Cop yTableCell">
    <td width="542" valign="top"><i mg src="img/mm_spacer.gif" alt=""
    width="305" height="1" border="0" /><br />
    &nbsp; <br />
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
    <td height="35" valign="top" class="pageName ">Contact Us </
    td>
    </tr>
    <tr valign="top">
    <td height="371" class="bodyText "><p>Your email has been
    received and will be answered shortly.</p>
    <p align="left"><i mg src="img/emailfire.gif" width="105"
    height="129" /</p></td>
    </tr>
    </table>
    <br />
    &nbsp;<br /> <img src="img/mm_spacer.gif" alt="" width="50"
    height="1" border="0" /></td>
    </table>'; ?>

    Some pages dont work cause i use a ' symbol in the content.

    Is there a better way to do breadcrumbs?

    Thanks
    Tom

  • petersprc

    #2
    Re: New to PHP help with breadcrumbs

    You can escape the single quote (\'). But you may want to just put the
    content outside the script tags instead of putting it in a variable.

    Here's a breadcrumb function that uses the file system to get path
    info:

    Founded in 1998, evolt.org was one of the oldest Web development communities in existence. Through our mailing lists, articles, and archives, we have strived to work together in sharing our collective knowledge to improve the Web for all of us.


    On Feb 11, 12:43 pm, "tommylux" <tommy...@gmail .comwrote:
    Hi there So far I have designed a simple template file in PHP:
    >
    <?php if(!$page) $page="home";
    if(file_exists( "/my root/public_html/progress/$page.html")) {
    include("/my root/public_html/progress/$page.html"); } else {
    include("/my root/public_html/progress/404.html"); } ?>
    >
    Where I want the breadcrumbs, i have a: <?php print($location ); ?>
    >
    and the content below breadcrumbs is: <?php print($content) ; ?>
    >
    My example $page looks like this:
    >
    <?php $location=" <a href=\"index.ph p?page=home\">H OME</a&nbsp »
    &nbsp <a href=\"index.ph p?page=\contact ">CONTACT US</a>";
    $content='<tabl e border="0" cellspacing="0" cellpadding="0"
    dwcopytype="Cop yTableCell">
    <td width="542" valign="top"><i mg src="img/mm_spacer.gif" alt=""
    width="305" height="1" border="0" /><br />
    &nbsp; <br />
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
    <td height="35" valign="top" class="pageName ">Contact Us </
    td>
    </tr>
    <tr valign="top">
    <td height="371" class="bodyText "><p>Your email has been
    received and will be answered shortly.</p>
    <p align="left"><i mg src="img/emailfire.gif" width="105"
    height="129" /</p></td>
    </tr>
    </table>
    <br />
    &nbsp;<br / <img src="img/mm_spacer.gif" alt="" width="50"
    height="1" border="0" /></td>
    </table>'; ?>
    >
    Some pages dont work cause i use a ' symbol in the content.
    >
    Is there a better way to do breadcrumbs?
    >
    Thanks
    Tom

    Comment

    • tommylux

      #3
      Re: New to PHP help with breadcrumbs

      In my template page, i am currently trying to put the PHP Print before
      include, and it doesnt work. Is there a PHP Command to open or pass
      the php file without including it on the page?

      <?php print($breadcru mb); ?>
      <?php include("/home/embers-o/public_html/progress/breadcrumb/
      content.php"); ?>

      Thanks

      Tom


      On Feb 11, 9:02 pm, "petersprc" <peters...@gmai l.comwrote:
      You can escape the single quote (\'). But you may want to just put the
      content outside the script tags instead of putting it in a variable.
      >
      Here's a breadcrumb function that uses the file system to get path
      info:
      >
      Founded in 1998, evolt.org was one of the oldest Web development communities in existence. Through our mailing lists, articles, and archives, we have strived to work together in sharing our collective knowledge to improve the Web for all of us.

      >
      On Feb 11, 12:43 pm, "tommylux" <tommy...@gmail .comwrote:
      >
      Hi there So far I have designed a simple template file in PHP:
      >
      <?php if(!$page) $page="home";
      if(file_exists( "/my root/public_html/progress/$page.html")) {
      include("/my root/public_html/progress/$page.html"); } else {
      include("/my root/public_html/progress/404.html"); } ?>
      >
      Where I want the breadcrumbs, i have a: <?php print($location ); ?>
      >
      and the content below breadcrumbs is: <?php print($content) ; ?>
      >
      My example $page looks like this:
      >
      <?php $location=" <a href=\"index.ph p?page=home\">H OME</a&nbsp »
      &nbsp <a href=\"index.ph p?page=\contact ">CONTACT US</a>";
      $content='<tabl e border="0" cellspacing="0" cellpadding="0"
      dwcopytype="Cop yTableCell">
      <td width="542" valign="top"><i mg src="img/mm_spacer.gif" alt=""
      width="305" height="1" border="0" /><br />
      &nbsp; <br />
      <table border="0" cellspacing="0" cellpadding="0" width="100%">
      <tr>
      <td height="35" valign="top" class="pageName ">Contact Us </
      td>
      </tr>
      <tr valign="top">
      <td height="371" class="bodyText "><p>Your email has been
      received and will be answered shortly.</p>
      <p align="left"><i mg src="img/emailfire.gif" width="105"
      height="129" /</p></td>
      </tr>
      </table>
      <br />
      &nbsp;<br / <img src="img/mm_spacer.gif" alt="" width="50"
      height="1" border="0" /></td>
      </table>'; ?>
      >
      Some pages dont work cause i use a ' symbol in the content.
      >
      Is there a better way to do breadcrumbs?
      >
      Thanks
      Tom

      Comment

      • petersprc

        #4
        Re: New to PHP help with breadcrumbs

        One way would be to paste the contents of content.php into the calling
        script:

        <? echo $bread; ?>

        [...content...]

        Are you getting an error currently?

        Comment

        • tommylux

          #5
          Re: New to PHP help with breadcrumbs

          peter, very new to php so forgive me that i dont understand fully of
          your last post.

          so I want the breadcrumbs with hyperlinks at the top of the page
          before i include the content.php. Template page:
          =========
          Normal HTML template...
          <?php print($breadcru mb); ?>
          Normal HTML template...
          <?php include("/home/embers-o/public_html/progress/breadcrumb/
          content.php"); ?>
          =========

          My content php would look like:

          =========
          <?php $breadcrumb= "<a href=\"index.ph p?page=home\">H OME</a&nbsp »
          &nbsp <a href=\"index.ph p?page=contact\ ">CONTACT US</a>"; ?>
          Normal HTML Content...
          =========

          It works when i put the: $breadcrumb after the content but not before.

          Not sure how to implement the echo in your suggestion. maybe in the
          template page:

          please help

          Tom

          On Feb 12, 12:05 am, "petersprc" <peters...@gmai l.comwrote:
          One way would be to paste the contents of content.php into the calling
          script:
          >
          <? echo $bread; ?>
          >
          [...content...]
          >
          Are you getting an error currently?

          Comment

          • petersprc

            #6
            Re: New to PHP help with breadcrumbs

            Your page could look like this:

            <?
            require('pre.ph p')
            $trail[] = array('home', 'contact');
            ?>
            Stuff
            <? require('top.ph p') ?>
            Content

            In top.php, you could print out the trail. You can also just use a
            string instead ($trail = "<a>...|<a>..." ).

            Comment

            Working...