---
title: "URL im Fluid rendern"
url: "https://www.typo3.net/d/113664-url-im-fluid-rendern"
source: "typo3.net"
tags: ["Archiv","Flow","Frage"]
created: "2013-01-29"
last_reply: "2013-01-29"
replies: 4
solved: false
page: 1
pages: 1
lang: "de"
---

# URL im Fluid rendern

Archiv › Flow · 4 Antworten · gestartet 2013-01-29

## Eröffnungsbeitrag

**Jan.​S** · 2013-01-29 · [Beitrag #1](https://www.typo3.net/d/113664-url-im-fluid-rendern/1)

Hallo,
Ich versuche eine URL ohne A Tag zu render.
Eigentlich müsste das mit den widget.uri funktionieren.

```php
<f:widget.uri action="show" />
```

Leider bekomme ich eine Fehlermeldung aus der ich nicht wirklich schlau werde. #angry#

```php
Fatal error: Call to undefined method Tx_Extbase_MVC_Web_Request::getArgumentPrefix()
```

Hat jemand eine Idee?

(oh ich hab gerade gesehen das ich im Falschen Forumszweig gepostet habe, sorry)

## Antworten

### [#2](https://www.typo3.net/d/113664-url-im-fluid-rendern/2) · Jan.​S · 2013-01-29

muss man irgendwas beachten wenn man ein Widget benutzt?
Habe sonst noch nie ein Widget eingesetzt. #paralyzed#

### [#3](https://www.typo3.net/d/113664-url-im-fluid-rendern/3) · Jan.​S · 2013-01-29

Im Widget gibt es folgende Code Zeile

```php
		$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
```

Der controllerContext ist vorhanden, das getRequest liefert auch was zurück nur das getArgumentPrefix funktioniert nicht. #evil#

### [#4](https://www.typo3.net/d/113664-url-im-fluid-rendern/4) · Jan.​S · 2013-01-29

Habe für mich eine Lösung gefunden und zwar hab ich den normalen action link Viewhelper genommen und minimal angepasst.

```php
<?php
	class Tx_DEINEXTENSIONNAME_ViewHelpers_UriViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper {
	


	     
	 /**
	  *  @var string
	 */
	protected $tagName = 'a';

	/**
	 * Arguments initialization
	 *
	 * @return void
	 */
	public function initializeArguments() {
		$this->registerUniversalTagAttributes();
		$this->registerTagAttribute('name', 'string', 'Specifies the name of an anchor');
		$this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document');
		$this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document');
		$this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document');
	}

		/**
		 * @param string $action Target action
		 * @param array $arguments Arguments
		 * @param string $controller Target controller. If NULL current controllerName is used
		 * @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
		 * @param string $pluginName Target plugin. If empty, the current plugin name is used
		 * @param integer $pageUid target page. See TypoLink destination
		 * @param integer $pageType type of the target page. See typolink.parameter
		 * @param boolean $noCache set this to disable caching for the target page. You should not need this.
		 * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
		 * @param string $section the anchor to be added to the URI
		 * @param string $format The requested format, e.g. ".html"
		 * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
		 * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
		 * @param boolean $absolute If set, the URI of the rendered link is absolute
		 * @param boolean $addQueryString If set, the current query parameters will be kept in the URI
		 * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
		 * @return string Rendered link
		 */
		public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array()) {
			$uriBuilder = $this->controllerContext->getUriBuilder();
			$uri = $uriBuilder
				->reset()
				->setTargetPageUid($pageUid)
				->setTargetPageType($pageType)
				->setNoCache($noCache)
				->setUseCacheHash(!$noCacheHash)
				->setSection($section)
				->setFormat($format)
				->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
				->setArguments($additionalParams)
				->setCreateAbsoluteUri($absolute)
				->setAddQueryString($addQueryString)
				->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
				->uriFor($action, $arguments, $controller, $extensionName, $pluginName);

			$this->tag->addAttribute('href', $uri);
			$this->tag->setContent($this->renderChildren());
			$this->tag->forceClosingTag(TRUE);

			return $uri;
		}
}
?>
```

Habe eigentlich nur direkt die $uri Variable geturnt und nicht das tag.
Naja es tut auf jeden Fall was es soll und zwar nur die Nackte URL rausrücken :p

Danke fürs zuhören ;)

### [#5](https://www.typo3.net/d/113664-url-im-fluid-rendern/5) · Jan.​S · 2013-01-29

Hab gerade gesehen das es genau den ViewHelper schon gibt.
<f:uri:action...

#angry##angry##angry##angry##angry##angry##angry##angry#

---

Quelle: „URL im Fluid rendern“, typo3.net, https://www.typo3.net/d/113664-url-im-fluid-rendern
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
