Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3671280
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:28:04+00:00 2026-05-19T02:28:04+00:00

Well I have this code – function breadcrumbs($separator = ‘ » ‘, $home =

  • 0

Well I have this code –

function breadcrumbs($separator = ' » ', $home = 'Home') {
    $path = array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
    $base = ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
    $breadcrumbs = Array("<a href=\"$base\">$home</a>");
    foreach ($path AS $x => $crumb) {
        $title = ucwords(str_replace(Array('.php', '_', '-'), Array('', ' ', ' '), $crumb));
        $breadcrumbs[] = "<a href=\"$base$crumb\">$title</a>";  
    }
    return implode($separator, $breadcrumbs);
}

And lets say I am at the page url of:

http://www.mysite.com/forums/general/log-book

this function displays the breadcrumb correctly as Home » Forums » General » Log Book.

However, when I click on one of the breadcrumb links it only goes back to the basic site url structure – such as “General” goes back to http://www.mysite.com/general when it actually should go to

http://www.mysite.com/forums/general

How do you guys suggest I go about fixing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:28:04+00:00Added an answer on May 19, 2026 at 2:28 am

    Try this instead:

    function breadcrumbs($separator = ' &raquo; ', $home = 'Home') {
        $path = array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
        $base = ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
        $breadcrumbs = Array("<a href=\"$base\">$home</a>");
        foreach ($path AS $x => $crumb) {
            $title = ucwords(str_replace(Array('.php', '_', '-'), Array('', ' ', ' '), $crumb));
            $breadcrumbs[] = "<a href=\"$base$crumb\">$title</a>";  
            $base = $base.$crumb.'/';
        }
        return implode($separator, $breadcrumbs);
    }
    

    Note the changed line $base = $base.$crumb.'/';

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well i have made this jquery code $(document).ready(function(){ $(.graduate).keyup(function(e){ if(e.keyCode!=8 && (e.keyCode<48 && e.keyCode>57)){
Hello Stack Overflow i hope you are well today, I have this code: $('.add_child').click(function(){
I have this code which works well: Public Function LoadBinaryFile(strFilename As String) As Byte()
Well I have this code in my Managed C++/Cli in Visual Studio 2008, I
I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
i have this PHP code, and a DataBase with Question, answer1, answer2, Question_id well,
I have this code, and for some reason my $.post function fires twice in
Well i have this code to find the paint quality of a room. void
I have this code: <script type=text/javascript> $(document).ready(function() { $(#iframeId).contents().find(body).append($(#test)); }); </script> <iframe id=iframeId name=iframeId
I have this code and in Firefox is working well, but in Chrome I'am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.