[Neos] Re: Show the actual URL on the site

9pm 9pm at gmx.net
Wed Jan 8 10:07:00 CET 2014


Hey!

You're able to create your own ViewHelpers of your site. For that you have to create the following structure:

Sites / VENDOR.YourSite / Classes / VENDOR / YourSite / ViewHelpers

In the ViewHelpers folder you create your ViewHelper ... for example: GetCurrentUriViewHelper.php
The content / structure of a ViewHelper should be known and won't be mentioned here. The render function contains this few lines:


        $uriObject = $this->controllerContext->getUriBuilder()->getRequest()->getHttpRequest()->getUri();
        $uri = $uriObject->getHost() . $uriObject->getPath();
        return $uri;


Now you can access this ViewHelper in your template
<foo:getCurrentUri />

Of course you first have to set the namespace:
{namespace foo=VENDOR\YourSite\ViewHelpers}

Maybe you have to grant the access to this ViewHelper in a Policy.yaml...

Greetings


More information about the Neos mailing list