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 your index.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 to Breadcrumbs class.
- Add optional parameter (name of
Url service registered in the container) to constructor.
Description
Suppose that Phalcon project is placed in the subdirectory. Then
Html\Breadcrumbsutility cannot generate links correctly.Steps
$subdir.$_GET['_url'] ?? ''as argument for$app->handle()method in yourindex.phpfile.Breadcrumbsinstance and add some entries.Expected behavior
Generated URLs should match pattern
localhost/{$subdir}/*.Actual behavior
Generated URLs match pattern
localhost/*.Details
Comments
Personally, I see two ways to achieve this.
setBaseUri(string $baseUri)method toBreadcrumbsclass.Urlservice registered in the container) to constructor.