Reputation: 213
I want to access get vars (or maybe post vars) in the controller of an extbase extension. I use TYPO3 7.6.12
This is the code in my controller:
public function showAction(\Test\MdIframe\Domain\Model\Iframe $iframe = NULL)
{
\TYPO3\CMS\Core\Utility\DebugUtility::debug($_REQUEST);
$args = $this->request->getArguments();
print_r($args);
The debug function works, I get a filled array but $args
remains an empty array.
Why? Has somebody an idea?
Upvotes: 0
Views: 1030
Reputation: 3354
With $this->request->getArguments
you only get Arguments defined by the action and passed by ?tx_myextension_plugin[argument]=value
(f:link.action
put his arguments passed automaticaly to this prefix):
public function showAction($item = 12, $short = false)
{
print_r($this->request->getArguments());
}
will outputs like this:
Array
(
[item] => 12
[short] => false
)
If you want to access global _GET vars you can use \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('var');
to get ?var=value
Upvotes: 8
Reputation: 2269
The arguments you try to fetch must be in controller request context. Your post data should be addressed to the controller like:
tx_extensionname_pluginname[object][property]
If you use f:form in your template, FLUID will do this for you and your form and post data are in correct syntax.
Upvotes: 0