cphalcon
cphalcon copied to clipboard
[BUG]: Breadcrumbs not support subdirectory
Description
Suppose that Phalcon project is placed in the subdirectory. Then Html\Breadcrumbs
utility cannot generate links correctly.
Steps
- Place your project in the subdirectory
$subdir
. - To make it work in subdirectory, use
$_GET['_url'] ?? ''
as argument for$app->handle()
method in yourindex.php
file. - Create
Breadcrumbs
instance and add some entries. - 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.
- Add
setBaseUri(string $baseUri)
method toBreadcrumbs
class. - Add optional parameter (name of
Url
service registered in the container) to constructor.