Closed Idreesshahzaib closed 7 years ago
doesn't look like you are adding the extension properly.
path_for('home')
work with named routes with setName
f.ex.
$app->get('/', 'App\Controllers\Home:index')->setName('home');
answered.
path_for('home')
work with named routes with setName f.ex.$app->get('/', 'App\Controllers\Home:index')->setName('home');
Im on slim4 is ->setName method from routing got removed? path_for is also not working for me this is my route
$app->any('/home', \App\Controller\HomeController::class)->setName('home');
{{ path_for('home') }}
Im on slim4 is ->setName method from routing got removed?
@Cvar1984 no, it's still here: https://github.com/slimphp/Slim/blob/4.x/Slim/Interfaces/RouteInterface.php#L85
path_for is also not working for me
The functionality has moved to the RouteContext
object:
http://www.slimframework.com/docs/v4/objects/request.html#obtain-base-path-from-within-route
Im on slim4 is ->setName method from routing got removed?
@Cvar1984 no, it's still here: https://github.com/slimphp/Slim/blob/4.x/Slim/Interfaces/RouteInterface.php#L85
path_for is also not working for me
The functionality has moved to the
RouteContext
object: http://www.slimframework.com/docs/v4/objects/request.html#obtain-base-path-from-within-route
I got string(0) ""
from
$view = \Slim\Views\Twig::fromRequest($request);
$basePath = \Slim\Routing\RouteContext::fromRequest($request)->getBasePath();
I want to get absolute url for loading assets, i have try using twig-assets too, but it wont't load an images
path_for
is removed in commit 71d9bb9cc68. Replace with url_for()
or full_url_for()
.
I am getting error Unknown "path_for" function in "/Templates/Partials/index.twig" at line 11. here is index .twig
{% extends "Base.twig" %}
{% block content %}
here is view in container `$container['View'] = function ($container) { return new \Slim\Views\Twig( DIR . '/../App/Views',[ 'cache' => false //dirname(FILE) . '/../Caching' ]);
};`