cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG]: Breadcrumbs not support subdirectory

Open gskierk opened this issue 4 years ago • 0 comments

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.

gskierk avatar Apr 25 '20 22:04 gskierk