#typo3

How to create an internal URI in TYPO3

Sometimes you want to generate TYPO3 internal URIs programmatically. Now you could try to create the URL manually on your own, or use the UriBuilder class. This handy tool is pretty neat to create any kind of internal URI. In a controller this class is available by $this->getControllerContext()->getUriBuilder(). If you want to use the UriBuilder somewhere else, you need to load an instance of the class by the ObjectManager.

$objectManager = 
  GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager\ObjectManager::class);
$uriBuilder =
  $objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);

When you have access to an instance of the builder, it's pretty straight forward from now on. The class has a bunch of simple setters, to control the generation of the URI. Best practice is to reset all the options of the builder on start of every new URI creation.

read more ...
Share:

Overwrite the default layout in TYPO3

I'm pretty sure that many people search for this thing already. So did I. It took me quite a lot time to figure out, how to overwrite the default template in TYPO3 8.7. This layout comes with some annoying wrappings, like the new frames. So you may want to remove them too. When you know how, it's really easy to do. Just add a small part to your TypoScript setup.

lib {
  contentElement {
    layoutRootPaths {
      10 = EXT:page/Resources/Private/Layouts
    }
  }
}
read more ...
Share: