Skip to content

[BUG]: Breadcrumbs not support subdirectory #14957

Open
@gskierk

Description

@gskierk

Description
Suppose that Phalcon project is placed in the subdirectory. Then Html\Breadcrumbs utility cannot generate links correctly.

Steps

  1. Place your project in the subdirectory $subdir.
  2. To make it work in subdirectory, use $_GET['_url'] ?? '' as argument for $app->handle() method in your index.php file.
  3. Create Breadcrumbs instance and add some entries.
  4. Extract breadcrumbs in the view.

Expected behavior
Generated URLs should match pattern localhost/{$subdir}/*.

Actual behavior
Generated URLs match pattern localhost/*.

Details

  • Phalcon version: 4.0.5
  • PHP Version: 7.4.4

Comments
Personally, I see two ways to achieve this.

  1. Add setBaseUri(string $baseUri) method to Breadcrumbs class.
  2. Add optional parameter (name of Url service registered in the container) to constructor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions