[TYPO3-mvc] viewHelper for URIs can't access Enviroment

Bastian Waidelich bastian at typo3.org
Wed Aug 4 10:05:53 CEST 2010


David Bruchmann wrote:

Hi David,

> I still need a way to get the url-name for a plugin like
> tx_[EXTENSION KEY SHORTENED]_[PLUGIN-KEY / CONTROLLER]

Given an extension with the extKey "blog_example" and a plugin 
"MyPlugin" results in following names:

Extension key:
  blog_example
  = $_EXTKEY

Extension name:
  BlogExample (used e.g. in class names)
  = t3lib_div::underscoredToUpperCamelCase($_EXTKEY)

Plugin name:
  MyPlugin (UpperCamelCase)
  = as used in Tx_Extbase_Utility_Extension::configurePlugin() and 
Tx_Extbase_Utility_Extension::registerPlugin()

Plugin signature:
  blogexample_myplugin (used in TypoScript, TCA)
  = strtolower($extensionName . '_' . $pluginName)

PluginNamespace:
  tx_blogexample_myplugin (used to namespace GET/POST vars)
  = 'tx_' . $pluginSignature


Normally you work with extension name and plugin name inside 
Extbase/Fluid. So you can resolve the argument prefix like this
$prefix = 'tx' . strtolower($extensionName . '_' . $pluginName);

See Tx_Extbase_MVC_Web_Routing_UriBuilder::uriFor()

To convert extension keys to extension names vice versa have a look at
t3lib_div::underscoredToUpperCamelCase()
and
t3lib_div::camelCaseToLowerCaseUnderscored()

HTH.

By the way: may I ask what you want to achieve and why you don't use the 
UriBuilder for it?

Best,
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list